Excel VBA – Export Each Worksheet to a Separate PDF – Macro
If you need to Export Each sheet to an individual .pdf file this Macro will do it for you.
It will go through all the sheets in your Workbook and save each one to a separate PDF file using the worksheet name as file name.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Sub ExportToPDFs() ' 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:="C:\Exports\" & nm & ".pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=False Next ws End Sub |
Posted by Excel Instructor:
http://www.houstoncomputerclasses.com/excel-classes/
Submit your review | |
Excel had an issue with the last line before "next ws", might just be my lack of knowledge, but I was not able to use this macro. Maybe a little more instruction would help?
Most likely cause you didn't modify the path to your final folder accurately, no other changes are necessary. Many people were able to use the macro successfully as you can see from comments. Keep in mind that this macro is for Windows Excel users.
Good to see
Great and thanks!
Great! Thank you so much for sharing this. I spend hours doing this every week. Now it's just a click away.
