Bug 149786 - VBA ExportAsFixedFormat to Export As PDF
Summary: VBA ExportAsFixedFormat to Export As PDF
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
Reported: 2022-06-30 09:04 UTC by Óvári
Modified: 2022-07-03 21:18 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

ExportAsPDF.xls (63.00 KB, application/vnd.ms-excel)
2022-06-30 09:04 UTC, Óvári
ExportAsPDF.pdf (388.38 KB, application/pdf)
2022-06-30 09:06 UTC, Óvári

Note You need to log in before you can comment on or make changes to this bug.
Description Óvári 2022-06-30 09:04:36 UTC
Created attachment 181030 [details]

Please enable VBA compatibility support for Microsoft Excel 2010 VBA code to export as PDF.

Attached is the MS Excel spreadsheet with the macro:

Sub ExportAsPDF()
    ActiveSheet.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        Filename:=".\ExportAsPDF.pdf", _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
End Sub

When the macro code is run with LibreOffice Community an error occurs:
BASIC runtime error
Property or method not found: ExportAsFixedFormat.

The output `ExportAsPDF.pdf` will be attached in a later as only 1 attachment is allowed.

Thank you
Comment 1 Óvári 2022-06-30 09:06:00 UTC
Created attachment 181031 [details]

Output PDF file from MS Excel 2010 when running the macro `ExportAsPDF()`.
Comment 3 Óvári 2022-07-03 21:18:26 UTC
(In reply to m.a.riosv from comment #2)
Thank you for your response.

At “Projects selected for LibreOffice in the Google Summer of Code 2022”
Ilmari Lauhakangas wrote:
I think the best way is to create a new bug report for each missing function and add 108908 to the “Blocks” field.
To see what is already covered in the bug tracker, see the dependency tree of the meta bug: https://bugs.documentfoundation.org/showdependencytree.cgi?id=108908&hide_resolved=1
Isn’t “ExportAsFixedFormat” a missing function in LO VBA compatibility?

Saving (or exporting) as PDF does not require a virtual PDF printer driver to be installed.

LibreOffice Calc → Menu Bar → File → Export as PDF… enables PDFs to be created without using a virtual PDF printer.

LibreOffice VBA compatibility support printing to a printer; however, VBA compatibility does not currently support PDF exporting. Surely this is a feature that is required as more processes become digitised?

It seems that the VBA syntax of the “ExportAsFixedFormat” method is generally as follows:
expression.ExportAsFixedFormat (Type, Filename, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish)

Internet search of “vba export as pdf” finds pages like:

Excel VBA Save As PDF: Step-By-Step Guide And 10 Code Examples To Export Excel To PDF

Excel VBA to Export Selected Sheets to PDF

Save Excel as PDF with VBA

Can the status of this issue please be set to NEW?

Thank you