Fix Excel for Mac VBA ExportAsFixedFormat Printing Instead of Saving a PDF
Question details
The user needs an Excel VBA macro to save a worksheet as a PDF instead of printing it on paper.

- Product
- Microsoft Excel for Mac
- Device & OS
- macOS
- Scenario
- A VBA macro calls ExportAsFixedFormat to export the active worksheet as a PDF.
- Observed behavior
- Running the macro prints to a physical printer instead of producing the expected PDF file.
Identify the worksheet to export and choose an existing local folder where Excel can save files. Check whether the filename variable already includes a folder path or the .pdf extension.
Specify a PDF filename and test the worksheet export
Use an explicit output path and worksheet to rule out an incorrect filename or active sheet.
In Excel, open Tools > Macro > Visual Basic Editor and find the macro containing ExportAsFixedFormat.
Set the filename to a full path in an existing local folder, including the .pdf extension. For example, replace the placeholder with your Mac username and use: fileName = "/Users/yourname/Documents/report.pdf".
Select the intended worksheet in Excel, then use: ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileName. Alternatively, refer to a specific worksheet in the macro instead of relying on ActiveSheet.
Run the macro from the VBA editor, then open the chosen folder in Finder and look for report.pdf. If the macro appends ".pdf" to the variable, make sure the variable does not already include that extension.

Check manual PDF export, permissions, and Excel updates
Use these checks if the corrected macro still fails to create a PDF.
Export spreadsheets to PDF with WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for opening Excel files and exporting spreadsheets to PDF. It can help you move between compatible document formats, but it does not fix Excel's VBA export behavior.

Frequently Asked Questions
Why does my macro print on paper when it should export a PDF?
ExportAsFixedFormat is intended to create a PDF file. Check the filename and folder path, then inspect the macro and any procedures it calls for PrintOut or other print commands.
Should the Filename argument include .pdf?
Yes. Supply a complete filename such as /Users/yourname/Documents/report.pdf. If your code appends ".pdf" to a variable, do not include the extension in that variable as well.
How can I test PDF creation without running the macro?
In Excel for Mac, choose File > Print, open the PDF menu in the print dialog, and select the option to save as PDF. Check the destination folder for the file.
Does ActiveSheet always export the sheet I expect?
No. ActiveSheet refers to the sheet active when the macro runs. Select the intended sheet before running the macro or reference the worksheet explicitly in your VBA code.
Can WPS Office fix the Excel VBA macro?
No. WPS Office is an alternative for working with compatible Excel files and exporting spreadsheets to PDF; it does not repair Excel's VBA behavior. Check macro compatibility separately before migrating a VBA-dependent workbook.




