Hello, I am trying to export a large amount of worksheets into separate pdfs with the file name as the sheet name but I am getting error invalid call or procedure but im not sure what is wrong, any help would be appreciated.
VBA Code:
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