Macro to export every worksheet to a separate PDF on a Mac

sduttonusa

New Member
Joined
Jan 13, 2016
Messages
43
For a couple of years, I've been using a macro in Excel on Windows 10 (running in Parallels on my Mac) that will export each worksheet in my workbook to a separate PDF, saving all of them in a Desktop Folder on my Mac called "ExcelPDFReports" . . . here's the code that works perfectly:

Code:
Sub ExportToPDFsOnZDrive()' PDF Export Macro
' Change C:\Exports\ to your folder path where you need the diles saved
' Save Each Worksheet to a separate PDF file.


Dim ws As Worksheet


For Each ws In Worksheets
ws.Select
nm = ws.Name


ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
FileName:="Z:\Users\sdutton\Desktop\ExcelPDFReports\" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False


Next ws


End Sub

I would really like to get this to work directly on my Mac. When I try, I get an Error In Printing, with all four lines of code highlighted. Any suggestions on how to get this to work on a Mac?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top