I've managed to save an active worksheet as a pdf using the following:
Sub save_as_pdf()
Dim Path As String
Dim filename As String
Path = Range("B35")
filename = Range("B36")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Path & filename & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
This code is currently on a sheet called 'Data' where its being run from a button.
How can I save a specific worksheet (it will be Sheet1,) as a pdf using the set print area for that sheet? I tried putting the code and the macro run button on sheet1 but I get a system error when i run it.
Sub save_as_pdf()
Dim Path As String
Dim filename As String
Path = Range("B35")
filename = Range("B36")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Path & filename & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
This code is currently on a sheet called 'Data' where its being run from a button.
How can I save a specific worksheet (it will be Sheet1,) as a pdf using the set print area for that sheet? I tried putting the code and the macro run button on sheet1 but I get a system error when i run it.