CarlStephens
Board Regular
- Joined
- Sep 25, 2020
- Messages
- 128
- Office Version
- 2016
- Platform
- Windows
Hello All,
I currently have the below print to pdf code, and cannot for the life of me work out where it is saving the file, which I believe it is doing as the message box comes up. Is there an option in the code to bring up "Save As" once the pdf has opened to chose the save location? Also, when the code is naming the file, I need to add the persons name which is in cell A3....what would I need to add to the code to attach the name in the file name? Thank you.
Sub PrintToPDF()
Dim invoiceRng As Range
Dim pdfile As String
'Setting range to be printed
Set invoiceRng = Range("C12:L50")
pdfile = "Seabourn Offer Letter" & " - " & Format(Now(), "DD-MMM-YYYY") & ".pdf"
pdfile = ThisWorkbook.Path & strfile
invoiceRng.ExportAsFixedFormat Type:=xlTypePDF, _
filename:=pdfile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "Offer letter created."
End Sub
I currently have the below print to pdf code, and cannot for the life of me work out where it is saving the file, which I believe it is doing as the message box comes up. Is there an option in the code to bring up "Save As" once the pdf has opened to chose the save location? Also, when the code is naming the file, I need to add the persons name which is in cell A3....what would I need to add to the code to attach the name in the file name? Thank you.
Sub PrintToPDF()
Dim invoiceRng As Range
Dim pdfile As String
'Setting range to be printed
Set invoiceRng = Range("C12:L50")
pdfile = "Seabourn Offer Letter" & " - " & Format(Now(), "DD-MMM-YYYY") & ".pdf"
pdfile = ThisWorkbook.Path & strfile
invoiceRng.ExportAsFixedFormat Type:=xlTypePDF, _
filename:=pdfile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "Offer letter created."
End Sub