Fix Excel for Mac VBA PDF Export to SharePoint Issue
Question details
A user needs to export an Excel worksheet as a PDF and upload it directly to SharePoint using VBA, but the code does not work correctly on a Mac.

- Product
- Microsoft Excel for Mac
- Device & OS
- macOS
- Scenario
- Using a VBA procedure with the ExportAsFixedFormat method to save an Excel worksheet as a PDF to an HTTPS SharePoint URL.
- Observed behavior
- While the script successfully uploads the PDF to SharePoint on Windows, on macOS it either triggers the printer dialog or does nothing at all.
Ensure your Mac has local write permissions to save files to your Desktop or a temporary folder, and verify that your local OneDrive or SharePoint sync client is running.
Export PDF Locally First, Then Upload
Bypass the macOS VBA URL limitation by saving the PDF to a local directory before syncing or uploading it to SharePoint.
Excel for Mac handles file paths and HTTPS destinations differently than its Windows counterpart. Passing a SharePoint HTTPS URL directly to the ExportAsFixedFormat method on macOS often triggers the default printer instead of saving the document.
To resolve this platform limitation, you must split the process into two steps: modify your VBA macro to save the PDF to a local Mac folder, and then use a synced SharePoint folder or manual upload to get the file into the cloud.
Open your VBA editor and change the destination path in your ExportAsFixedFormat method from the SharePoint HTTPS URL to a local Mac path (e.g., /Users/Username/Desktop/output.pdf).
Execute the updated macro to generate the PDF. Verify that it saves successfully to your local Mac directory without opening the system print dialog.
Either manually drag the generated PDF into your SharePoint document library via a web browser, or configure your local save path to be inside a synced OneDrive/SharePoint folder so it uploads automatically in the background.

Try WPS Office for Mac for Seamless Spreadsheet Management
If you frequently encounter VBA compatibility issues and platform differences in Microsoft Office for Mac, WPS Office provides a highly compatible, lightweight, and user-friendly alternative for your document needs.
- 1. Download and Install WPS Office: Get the free WPS Office application for Mac from the official website and install it on your machine.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your existing Excel file.
- 3. Export to PDF Easily: Go to the 'Menu', select 'Export to PDF', choose your preferred local or cloud-synced folder, and save without needing VBA workarounds.

Frequently Asked Questions
Why does ExportAsFixedFormat print the document instead of saving it on a Mac?
On Excel for Mac, passing an HTTP/HTTPS URL (like a SharePoint link) directly to the ExportAsFixedFormat method is not properly supported. The application fails to recognize the web path as a valid save location and falls back to the default system print action instead.
Can I automate the upload from my local Mac folder to SharePoint?
Yes. While standard VBA cannot directly push to the SharePoint URL on Mac, you can use the AppleScriptTask function within your VBA code to trigger an external AppleScript that handles the upload, or simply save the file into a folder that is actively synced with OneDrive for Business.
How do I correctly format local file paths in Mac VBA?
For modern versions of Excel for Mac, it is recommended to use standard POSIX paths (e.g., /Users/username/Desktop/file.pdf). Be aware that due to Apple's app sandboxing rules, you may be prompted to grant file access permissions the first time the macro attempts to save a file.




