dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,392
- Office Version
- 365
- 2016
- Platform
- Windows
I have code to save as a pdf but it defaults to the directory that the spreadsheet is located in. I want it to ask where it wants to save the file. Could someone help me with updating this vba code please?
Code:
Sub save_pdf()
Dim currentSheet As Worksheet, fname As String
fname = ActiveSheet.Range("G7").Value & ActiveSheet.Range("H5").Value '" for " & ActiveSheet.Range("H5").Value
With ThisWorkbook
Set currentSheet = .ActiveSheet
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, fileName:=ThisWorkbook.Path & "\" & fname & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End With
End Sub