davidbrent
New Member
- Joined
- Feb 25, 2016
- Messages
- 6
Hello All,
I have a code that works great at saving open worksheets as separate .pdf but when i hide i sheet it returns an invalid call. I'm sure its a very simple fix but well beyond my beginner level unfortunately
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
End Sub
I have a code that works great at saving open worksheets as separate .pdf but when i hide i sheet it returns an invalid call. I'm sure its a very simple fix but well beyond my beginner level unfortunately
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
End Sub