Using the savebas VBA Excel function to save in PDF format with user interaction


Firstly - sorry if the title is somewhat confusing. I was not really sure how to title this problem.

I have this really simple vba macro which opens the saveas dialog and prefills filename based on a cell value:

Sub SaveAsFunction()

If Sheet1.Range("B17").Value = vbNullString Then
    MsgBox "Cell B17 must not be empty"
End If

Dim fileName As String
fileName = Sheet1.Range("B17").Value

Application.Dialogs(xlDialogSaveAs).Show fileName

End Sub

I've been asked if it's possible to change the "save as type:" field to PDF as the dialog opens but NOT save automatically. The enduser needs to navigate to the correct folder first. I've looked around but haven't found any threads explaining this specific issue.

Thank you.

Try this:

Sub pdf()
Application.Dialogs(xlDialogSaveAs).Show "*.*", 57
End Sub