Printing PDF from PowerPoint VBA

To print to PDF, you need to set the active printer to “Adobe PDF” or a similar PDF printer driver.

ActivePresentation.PrintOptions.ActivePrinter = "Adobe PDF"

Specify Print Range and Settings

You can specify various print settings like print range, number of copies, hidden slides, etc.

“`vb
With ActivePresentation.PrintOptions
.RangeType = ppPrintAll
.NumberOfCopies = 1
.PrintHiddenSlides = msoTrue
End With

## Export as PDF
Use the `ExportAsFixedFormat` method to export the presentation as a PDF file. Specify the file path, PDF as fixed format type and print intent.

vb
ActivePresentation.ExportAsFixedFormat fileName, ppFixedFormatTypePDF, ppFixedFormatIntentPrint

## Set PDF Filename and Location
Define the PDF filename dynamically and specify folder location where you want to save the PDF file.

vb
pdfFile = “C:\Reports\” & Format(Now(), “yyyymmdd”) & “_report.pdf”
ActivePresentation.ExportAsFixedFormat pdfFile, ppFixedFormatTypePDF, ppFixedFormatIntentPrint

## Print Silently to PDF
To print silently without user prompts, set `DisplayAlerts` to `False` before printing and back to `True` after.

vb
Application.DisplayAlerts = False
ActivePresentation.PrintOut
Application.DisplayAlerts = True
“`

Some key things to note are handling print settings, using the right export method, dynamically generating file name and path, and printing silently without alerts.