Skip to content

Instantly share code, notes, and snippets.

@kastnerp
Last active October 6, 2023 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastnerp/361d4cdf68d5843acc93dce40f33209d to your computer and use it in GitHub Desktop.
Save kastnerp/361d4cdf68d5843acc93dce40f33209d to your computer and use it in GitHub Desktop.
Export PPTX to PDF | Macro
Sub ConvertToPDFHighQuality()
Dim pdfFileName As String
Dim activePresentationPath As String
' Get the full path of the active presentation
activePresentationPath = ActivePresentation.FullName
' Create a PDF filename based on the original PowerPoint filename
pdfFileName = Replace(activePresentationPath, ".pptx", "_HighQuality.pdf") ' Make sure to replace .pptx with .pptm if macro is saved with presentation
pdfFileName = Replace(pdfFileName, ".pptm", "_HighQuality.pdf")
' Export to PDF with high-quality settings
ActivePresentation.ExportAsFixedFormat _
Path:=pdfFileName, _
FixedFormatType:=ppFixedFormatTypePDF, _
Intent:=ppFixedFormatIntentPrint, _
RangeType:=ppPrintAll
' Notify the user that the PDF has been created
MsgBox "PDF has been created with high-quality settings: " & pdfFileName
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment