How To ...

Export PowerPoint Slides as PDF with Title

Protected PDF
Exporting each slide of a PowerPoint presentation as separate PDF documents can be time consuming. We provide a small VBA script to do this.

Introduction

The code below will export your PowerPoint slides as individual PDF files. The title field of each slide is used as the name.

The Video

Coming Soon

The Super Quick Version

  • Copy and paste the code into the VBA editor of PowerPoint
  • Modify line folderPath = “C:\Users\simon\OneDrive\Desktop\” to point to the folder path you want to use to save the PDF files in.
  • Run the macro.

The Code

VBA Script

				
					'#############################################################################
'
' Script created by Imnoss Limited
' Last Updated: 2021-10-27
' Please feel free to share while retaining attribution
'
' For full instructions on how to use please visit:
' https://imnoss.com/batch-protect-pdfs-with-different-passwords/
'
'#############################################################################
Sub ExportEachSlideAsPdf()
Dim ppt As Presentation
Dim sld As Slide
Dim so As Shape
Dim pr As PrintRange
Dim fn As String
Dim folderPath As String
folderPath = "C:\Users\simon\OneDrive\Desktop\"
' grab the active presentation and run through each slide
Set ppt = ActivePresentation
For Each sld In ppt.Slides
   
    ' create a file name from the Title field(s) in the document
    fn = ""
    For Each so In sld.Shapes
        If Left(so.Name, 5) = "Title" Then
            fn = fn & " " & so.TextFrame.TextRange.Text
        End If
    Next so
    
    ' there might not be a title field in the document, so use a generic "Slide x" if no title found
    If fn = "" Then
        fn = "Slide " & sld.slideNumber & ".pdf"
    Else
        fn = Mid(fn, 2) & ".pdf"
    End If
    
    
    ' clear the print range and set it to just the current slide
    ppt.PrintOptions.Ranges.ClearAll
    Set pr = ppt.PrintOptions.Ranges.Add(Start:=sld.slideNumber, End:=sld.slideNumber)
        
    ' run the export
    ppt.ExportAsFixedFormat Path:=folderPath & fn, _
                            FixedFormatType:=ppFixedFormatTypePDF, _
                            RangeType:=ppPrintSlideRange, _
                            PrintRange:=pr, _
                            Intent:=ppFixedFormatIntentPrint, _
                            FrameSlides:=msoFalse
Next sld
End Sub
				
			

The Long Version

Coming Soon

To add a macro to Word you will need to be able to see the Developer tab. If you don’t have this appearing, that’s perfectly normal for Word, they hide it by default. To make it appear is you just right-click anywhere in the ribbon and select “Customise the Ribbon”. In the dialogue box which appears make sure the checkbox next to Developer in the right-hand column is checked. Once done press Ok, and the Developer tab will appear in the Ribbon. This contains the Visual Basic and Macro buttons on the left-hand side.

Click the Visual Basic button in the Developer tab to open the Visual Basic editor where we will add our macro. If you do not see a window called “Project” then click on the View menu and select “Project Explorer”. This will bring up the Project window. In this window right-click on “Normal” and in the contextual menu select “Insert” and then “Module”. A new file called “Module1” will appear in the Modules folder under “Normal” (the file may have a different number if Module1 already exists).

The middle of the window will be a white canvas – this is the editing space for the new module. Copy the Macro from this article and paste it into the middle of the VBA editor.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email