I purloined Ryan's code from another website. The code saves a range of cells selected by the user to a pdf and allows user to name that pdf.
Problem: I spec'd a default "save" path with this line:
strfile = "C:\Users\......\_2019-2020\2019-20 2nd Semester\Quant PDF Dump\\Selection_" & Format(Now(), "yyyymmdd_hhmmss") & ".pdf"
(Note: the ellipsis indicates portions of path statement hidden for privacy purposed. The path is correct.)
The code, however, defaults to "My Documents" for the save location instead of the final folder spec'd in the path, Quant PDF Dump\\
Thanks so much for taking time to read and respond to this query!
'DEVELOPER: Ryan Wells
'DESCRIPTION: Print your currently selected range to a PDF
Dim ThisRng As Range
Dim strfile As String
Dim myfile As Variant
If Selection.Count = 1 Then
Set ThisRng = Application.InputBox("Select a range", "Get Range", Type:=8)
Set ThisRng = Selection
'Prompt for save location'
strfile = "C:\Users\.....\_2019-2020\2019-20 2nd Semester\Quant PDF Dump\\Selection_" & Format(Now(), "yyyymmdd_hhmmss") & ".pdf"
'"C:\Users\.....\_2019-2020\2019-20 2nd Semester\Quant PDF Dump\" & Format(Now(), "yyyymmdd_hhmmss") & ".pdf" _
myfile = Application.GetSaveAsFilename _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File Name to Save as PDF")
If myfile <> "False" Then 'save as PDF
ThisRng.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myfile, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
MsgBox "No File Selected. PDF will not be saved", vbOKOnly, "No File Selected"