Excel for Mac 2011 - Save as PDF to given filepath

Using Excel for Mac 2011 I have created a single page report that i want to save as a pdf using a macro.  I want to save to a folder called "Report" on the desktop.  On a PC i can use the GetOpenFilename command to select the folder and then the code will create a file with a specific filename (taken from a cell within the sheet).  I am having trouble doing this on a mac however - i know there is some commentary online about this matter but i have so far been unsuccessful.  
2 questions:
How to specify the filepath
VBA syntax for creating the pdf
Help and guidance would be appreciated.
Who is Participating?

Pls try
Sub SavePDFMacro() 
    Dim folderPath As String
    Dim RootFolder As String

    On Error Resume Next
    RootFolder = MacScript("return (path to desktop folder) as String")
    'Or use RootFolder = "Macintosh HD:Users:YourUserName:Desktop:TestMap:"
    folderPath = MacScript("(choose folder with prompt ""Select the folder""" & _
    "default location alias """ & RootFolder & """) as string")
    On Error GoTo 0

    If folderPath <> "" Then
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ 
            folderPath &  ":" & Range("A1").Value, Quality:= _ 
            xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ 
    End If
End Sub

Open in new window

for reference

bbaoIT ConsultantCommented:
it seems not only you looking for a universal way to select a file using macro in Excel for both Windows and Mac.

first you need to apply all updates and patches for Excel 2011 for Mac, then if below discussion for details.

bbaoIT ConsultantCommented:
FYI - official how-to article

Programmatically Selecting Files in Excel for Windows and Excel for the Mac
JohnNZExcelAuthor Commented:
Problem solved and knowledge gained.  Created 2 procedures: 1 using the mac script to choose a folder and the other to save to a predetermined folder in the documents area.  Many thanks to the gurus.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.