PDF Conversion Issues

Fix Excel VBA ExportAsFixedFormat PDF Error on Mac & SharePoint

Khadija KhanKhadija Khan Nov 10, 2026 869 views

Question details

The user is unable to generate PDF files using the Excel VBA ExportAsFixedFormat method when iterating through dropdowns, specifically when the workbook is stored on SharePoint or OneDrive for Mac.

Fix Excel VBA ExportAsFixedFormat PDF Errors on Mac and SharePoint
Product
Microsoft Excel
Device & OS
Mac
Scenario
Running a VBA macro to automatically generate and export multiple PDFs based on dropdown list selections to a cloud-synced folder.
Observed behavior
The macro fails to execute or export the PDFs, typically returning a path error due to invalid SharePoint web URLs, missing local folders, or attempting to run the code in Excel for the Web.
Before you start

Ensure your OneDrive or SharePoint folders are fully synchronized and mounted locally on your Mac, as Excel VBA cannot save directly to a web URL using standard local file system commands.

Solution 1Recommended

Update VBA Code for Mac OneDrive Local Sync Paths

Use the correct local file path format for CloudStorage on Mac to allow the VBA macro to locate and save to the directory.

On Mac, OneDrive and SharePoint synced folders do not use standard Windows drive letters (like C:\) or web URLs. Instead, they reside in the local Library folder under CloudStorage.

1
Find the local path

Open Finder, navigate to your OneDrive or SharePoint synced folder, right-click the target output folder, hold the 'Option' key, and select 'Copy as Pathname'.

2
Update your VBA variable

Assign the copied local path to your PDFPath variable in the VBA editor (e.g., PDFPath = "/Users/yourname/Library/CloudStorage/OneDrive-Company/").

3
Add path validation

Use the Dir function in your VBA code to verify the folder exists before executing ExportAsFixedFormat, for example: If Dir(PDFPath, vbDirectory) = "" Then MsgBox "Folder not found".

4
Verify with Debug.Print

Add 'Debug.Print FullPath' before the export command to print the exact save destination in the Immediate Window, ensuring the path and filename are formatted correctly.

Update VBA Code for Mac OneDrive Local Sync Paths
Prevent Code Crashes: Testing the directory with Dir(PDFPath, vbDirectory) prevents Excel from crashing if the cloud folder hasn't finished syncing yet.
Free Microsoft Office alternative

Export to PDF Easily with WPS Office

Avoid complex VBA debugging on Mac and SharePoint. WPS Office is a free, lightweight alternative to Microsoft Office that offers seamless compatibility with Excel files and features a highly reliable, built-in PDF converter that works perfectly across different operating systems.

  1. 1. Open your workbook: Launch WPS Spreadsheets and open your .xlsx or .xlsm file.
  2. 2. Access the Export feature: Navigate to the 'Menu' or 'Tools' tab on the ribbon and select 'Export to PDF'.
  3. 3. Save your PDF: Choose your preferred local or synced cloud folder and click 'Export'.
Built-in, intuitive PDF conversion tool without requiring VBA macrosSeamless compatibility with Microsoft Excel formats (.xls, .xlsx, .xlsm)Free, lightweight, and fast performance on Mac and WindowsReliable local file management that avoids cloud-sync path errors
QA img-9

Frequently Asked Questions

Can I run Excel VBA macros in SharePoint online or Excel for the Web?

No, VBA macros cannot run in the browser version of Excel. You must open the workbook in the desktop application to run ExportAsFixedFormat. For web-based automation, consider using Office Scripts or Microsoft Power Automate.

Why do I get a 'Path not found' error on Mac when saving to OneDrive?

Mac uses a different file path structure than Windows. Instead of URLs or standard drive letters like C:\, OneDrive paths on Mac typically look like /Users/YourUsername/Library/CloudStorage/OneDrive-YourCompany/.

Will ExportAsFixedFormat automatically create a new folder if it is missing?

No, Excel will not automatically create missing folders during the PDF export process. You must ensure the folder exists manually or include VBA code (such as the MkDir command) to create it before exporting.

How can I verify where Excel is trying to save my PDF?

You can add the command 'Debug.Print FullPath' in your VBA code just before the ExportAsFixedFormat line. This will print the exact save destination in the Immediate Window (press Ctrl+G in the VBA editor to view it).