Mac Excel 15+ SaveAs PDF

DaytoData

New Member
Joined
Aug 22, 2017
Messages
3
I'm trying to save a sheet in the spreadsheet as a PDF, when it's ran I get the grant permission dialog box as well as the dialog to set the location and specify the file name. The file names are pre-set based on the FN value passed.
Example: FN = test.pdf

I want to completely bypass the both dialog boxes, how can I do this? Do I make adjustments in my trust center? I just need it to save it as test.pdf

Code:
Sub MacPDF(FN As String)
Dim fileAccessGranted As Boolean
    Dim filePermissionCandidates
    Dim wsPath As String
    
    wsPath = Application.ThisWorkbook.Path
    
    If Application.Version >= 15 Then
        
        ' Will prompt user for access to folder where workbook is located (only once)
        Application.DisplayAlerts = False
        filePermissionCandidates = Array(wsPath)
        fileAccessGranted = GrantAccessToMultipleFiles(filePermissionCandidates)
   
        


        sName = Application.GetSaveAsFilename(FN)


        If sName <> "False" Then
            ActiveWorkbook.SaveAs sName, FileFormat:=xlPDF
        End If
    End If
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top