Hi All,
I'm trying to create a macro to allow the print to PDF to have a shortcut key and save the excel sheet to the same folder and the workbook as the title of a particular cell in the active sheet. The current formula i am using is:
Sub save_excel_as_PDF()
With ActiveSheet.PageSetup
CenterHeader = "Sample Excel File Saved As PDF"
Orientation = xlPortrait
PrintArea = "$A$1:$F$40"
Zoom = False
FitToPagesTall = False
FitToPagesWide = 1
End With
ActiveSheet.ExportAsFixedFormat
Type:=xltypePDF
File:=activeworkbook.path"/"&activeSheet.range("B18").value,
Quality:=xlqualitystandard
ignoreprintarea:=false
From:=1,
To:=2,
Openafetrpublish:=true
End Sub
the final 8 lines of the code are causing me some issue as I continually get a compile error, expected: expression appears with the := highlighted
Can someone please check my code or provide a solution for this?
Cheer
J
I'm trying to create a macro to allow the print to PDF to have a shortcut key and save the excel sheet to the same folder and the workbook as the title of a particular cell in the active sheet. The current formula i am using is:
Sub save_excel_as_PDF()
With ActiveSheet.PageSetup
CenterHeader = "Sample Excel File Saved As PDF"
Orientation = xlPortrait
PrintArea = "$A$1:$F$40"
Zoom = False
FitToPagesTall = False
FitToPagesWide = 1
End With
ActiveSheet.ExportAsFixedFormat
Type:=xltypePDF
File:=activeworkbook.path"/"&activeSheet.range("B18").value,
Quality:=xlqualitystandard
ignoreprintarea:=false
From:=1,
To:=2,
Openafetrpublish:=true
End Sub
the final 8 lines of the code are causing me some issue as I continually get a compile error, expected: expression appears with the := highlighted
Can someone please check my code or provide a solution for this?
Cheer
J