Q:

How to open the Save As dialog and save as PDF

I have the following code, which gives the option to the user in the end to "Print" the worksheet
I wish to modify it. The user should be asked if we wants to "Export it to PDF", if he selects "Yes", then the native Excel save as dialog box should open (the one we get when we press F12), with "Save As Type" = PDF:
Sub sbHide_Rows_Based_On_Criteria_Optional_Print()
    Dim lRow As Long
    Dim iCntr As Long
    Dim asn As Integer  

    With Sheets("QuoteSheet")        
        lRow = .Cells(Rows.Count, "L").End(xlUp).Row            
        For iCntr = lRow To 1 Step -1
            If .Cells(iCntr, "L") = "Y" Then
               .Rows(iCntr).Hidden = True
            End If
        Next iCntr        
    End With

    answer = MsgBox("Do You Want a Printout?", vbYesNo + vbQuestion, "Print Sheet")
    If answer = vbYes Then ActiveSheet.PrintOut    
End Sub

A:

This should work:
answer = MsgBox("Do you want to export to PDF?", vbYesNo + vbQuestion, "Export to PDF")
If answer = vbYes Then
    fileSaveName = Application.GetSaveAsFilename("", fileFilter:="PDF (*.pdf), *.pdf")
    If fileSaveName <> False Then
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    End If
End If

