Greetings all.
I am looking for some help with the following script.
The script work well and saves the pdf in the correct folder but i have failed to get the saved file name to work
The file name is held in cell M1
Sub ExpPDF()
'Save PDF Document
Dim PathFile As String
Dim PathArray() As String
Dim PathPDF As String
Application.DisplayAlerts = False
'Get file path
PathFile = Application.ThisWorkbook.FullName
'Split file path in path and file ending
PathArray() = Split(PathFile, ".")
'Creat file path with ".pdf" ending
PathPDF = PathArray(0) & ".pdf"
'PDF File is saved in directory of workbook
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
PathPDF, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
'Closes Workbook after generatin PDF
ActiveWorkbook.Saved = True
Application.Quit
Application.DisplayAlerts = True
End Sub
Any help would be good please.
Bookmarks