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:
Thanks in advance for your help.
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.