VBA to open Access report and print it to a PDF

Starting with Access 2007, Access has a built-in easy way to export an Access report to a PDF file:

Public Sub PrinttoPDF(strFilePDF As String)

Dim RptName As String

RptName = "rptReport"

DoCmd.OpenReport RptName, acViewDesign, , , acHidden

DoCmd.Close acReport, RptName, acSaveYes

DoCmd.OutputTo acOutputReport, RptName, acFormatPDF, strFilePDF

End Sub