Suppress "Save" when saving Excel file as PDF

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
Dear,
I have the following macro to save an Excel file as PDF, which works fine, and will prefer to bypass the dialog box step of having to click at the "Save" button to finish the process. Please help me out with the necessary code to avoid this unnecessary step:
Code:
Sub FDA_2877()


Application.DisplayAlerts = False
Application.ScreenUpdating = False


Sheets("FDA-2877").Select
    
Set FSO = CreateObject("Scripting.FileSystemObject")
    
If Not FSO.FolderExists("C:\Users\" & Environ$("username") & "\Documents\TEMP FDA-2877\") Then
  FSO.CreateFolder ("C:\Users\" & Environ$("username") & "\Documents\TEMP FDA-2877\")
End If
    
ChDir "C:\Users\" & Environ$("username") & "\Documents\TEMP FDA-2877"
    
    fileSaveName = Application.GetSaveAsFilename(pdfName & "FDA-2877 AWB " & Sheets("Master Query").Range("G1").Value & " - " & Format(Date, "mm-dd-yy"), _
    fileFilter:="PDF Files (*.pdf), *.pdf")
    If fileSaveName <> False Then
    Worksheets("FDA-2877").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
Sheets("Master Query").Select
    Range("C2").Select
End Sub

Thanks in advance for your help.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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