Hi everyone would like to save copy of the workbook in PDF every time someone save the work and put the PDF in a different location
I have some code but I'm getting error with see code below
Thanks in advance
Cheers
Shane
I have some code but I'm getting error with see code below
Thanks in advance
Cheers
Shane
Code:
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
Dim Filename As String
Dim Filepath As String
Filepath = "C:\Users\Shane\Documents\"
Filename = Filepath & ThisWorkbook.Name
If Success Then
With ThisWorkbook.ExportAsFixedFormat _ ' this line highlights and i get error message ("compile error expected file or variable")
(Type:=xlTypePDF, _
Filename:=Filename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=True, _
OpenAfterPublish:=False)
End With
End If
End Sub