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.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Watch MrExcel Video

Forum statistics

Threads
1,109,020
Messages
5,526,296
Members
409,694
Latest member
bastos21

This Week's Hot Topics

Top