Jasperlee93
New Member
- Joined
- Dec 6, 2022
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Sub ExportPDF()
Dim FDialog As FileDialog
Dim FPath As String
Dim Sht As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set FDialog = Application.FileDialog(msoFileDialogFolderPicker)
FDialog.InitialFileName = ThisWorkbook.Path
If FDialog.Show = -1 Then
FPath = FDialog.SelectedItems(1)
End If
If FPath <> "" Then
For Each Sht In ThisWorkbook.Sheets
Sht.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FPath _
& Application.PathSeparator & Sht.Name & ".pdf"
Next Sht
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
above vba code is what I am currently using.
Dim FDialog As FileDialog
Dim FPath As String
Dim Sht As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set FDialog = Application.FileDialog(msoFileDialogFolderPicker)
FDialog.InitialFileName = ThisWorkbook.Path
If FDialog.Show = -1 Then
FPath = FDialog.SelectedItems(1)
End If
If FPath <> "" Then
For Each Sht In ThisWorkbook.Sheets
Sht.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FPath _
& Application.PathSeparator & Sht.Name & ".pdf"
Next Sht
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
above vba code is what I am currently using.