Export All Worksheet as PDF

Export all Excel Worksheets in separate PDF files

In this article, you will learn how to Export all Excel worksheets in separate PDF files. In this macro we have used FileDialog in VBA to get the folder path.

Below is the macro code which you can copy to your personal macro

Option Explicit

Sub ExportAsPDF()

Dim Folder_Path As String

With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select Folder path"
If .Show = -1 Then Folder_Path = .SelectedItems(1)
End With

If Folder_Path = "" Then Exit Sub

Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets
sh.ExportAsFixedFormat xlTypePDF, Folder_Path & Application.PathSeparator & sh.Name & ".pdf"

MsgBox "Done"

End Sub

Watch the step by step video tutorial:

Click here to download this practice file.

My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 12 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.