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" Next MsgBox "Done" End Sub
Visit our YouTube channel to learn step-by-step video tutorials
Watch the step by step video tutorial: