Try one of these depending on your needs:
Public Sub SaveWorksheetAsPDF()
'If the sheet has no data an error will occur.
sFileName = "C:\Test.pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
Public Sub SaveWorkbookAsPDF()
'If the sheet has no data an error will occur.
sFileName = "C:\Test.pdf"
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFileName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
Bookmarks