BritsBlitz
New Member
- Joined
- Jan 10, 2014
- Messages
- 34
- Office Version
- 365
- Platform
- Windows
I have the following Macro that will export a worksheet as a pdf using "Test_Summary_MMDDYYY" as the file name. The macro will save the pdf correctly, but it always saves it in the "downloads" folder on my MAC, instead of the destination folder I selected.
If I select the Desktop as the destination folder and I look at the value of saveSummary while the macro is running, it correctly shows the information as "Macintosh HD:Users:BritsBlitz:Desktop:Test_Summary_06052024.pdf", but it will still save the pdf in the Downloads folder instead of saving it to the desktop.
Any suggestions on what needs to be changed so that the pdf is actually saved in the destination folder?
If I select the Desktop as the destination folder and I look at the value of saveSummary while the macro is running, it correctly shows the information as "Macintosh HD:Users:BritsBlitz:Desktop:Test_Summary_06052024.pdf", but it will still save the pdf in the Downloads folder instead of saving it to the desktop.
Any suggestions on what needs to be changed so that the pdf is actually saved in the destination folder?
VBA Code:
Sub SavePDF()
Dim saveSummary As String
Dim saveFileName As String
Dim CurrentDate As String
Dim DestinationFolder As String
CurrentDate = Format(Date, "MMDDYYYY")
saveFileName = "Test"
[COLOR=rgb(0, 0, 0)]DestinationFolder = MacScript("(choose folder with prompt ""Select the folder"") as String")
saveSummary = DestinationFolder & saveFileName & "_Summary_" & CurrentDate & ".pdf"[/COLOR]
Worksheets("SUMMARY SHEET").ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveSummary
MsgBox ("The PDF has been saved")
End Sub
Last edited by a moderator: