Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub SaveSelectedSheetsSaveAsPDF()
- 'Create a PDF of each selected sheet in the same folder
- Dim ws As Worksheet
- Dim sheetArray As Variant
- Dim Path As String
- Path = Application.ActiveWorkbook.Path
- 'Capture the selected sheets
- Set sheetArray = ActiveWindow.SelectedSheets
- 'Loop through each selected worksheet
- For Each ws In sheetArray
- ws.Select
- ws.ExportAsFixedFormat Type:=xlTypePDF, _
- Filename:=Path & "\" & ws.Name & ".pdf", Quality:=xlQualityStandard, _
- IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
- Next ws
- 'Reselect the selected sheets
- sheetArray.Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement