-
Excel For Mac - Macro to Print Worksheets to Separate PDF File
I came across a Macro written for Excel on Windows . . . it works great and would like to use it on my Mac Excel. I want to have a Macro that will save each worksheet in a workbook to a separate PDF in a folder on my desktop. I changed the folder path in the script to reflect the Mac file structure . . . but the macro now goes through my entire workbook "printing" (not saving) every worksheet, and then goes back to the beginning and prints everything again (endless loop). So can someone help me figure out what needs to be changed to make this save the worksheets as a PDF file, (and how to make this happen just once)?
Sub ExportToPDFs()
' PDF Export Macro
' Change C:\Exports\ to your folder path where you need the files 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:=":Users:sduttonesktop:ExcelPDFReports:" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Next ws
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules