Bug 149786 - VBA ExportAsFixedFormat to Export As PDF
Summary: VBA ExportAsFixedFormat to Export As PDF
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
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:


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

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]
ExportAsPDF.xls

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, _
        OpenAfterPublish:=True
End Sub
```

When the macro code is run with LibreOffice Community 7.3.4.2 an error occurs:
BASIC runtime error
'423'
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]
ExportAsPDF.pdf

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”
https://blog.documentfoundation.org/blog/2022/05/26/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
https://powerspreadsheets.com/save-excel-file-pdf-vba/

Excel VBA to Export Selected Sheets to PDF
https://stackoverflow.com/questions/20750854/excel-vba-to-export-selected-sheets-to-pdf

Save Excel as PDF with VBA
https://exceloffthegrid.com/vba-code-save-excel-file-as-pdf/

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


Thank you