Renan Santos
Renan Santos

Reputation: 73

Export each slide of Powerpoint to a separate pdf file

I need to generate for each slide of my presentation a pdf file.

I'm using the following code:

ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\" & ActivePresentation.Name & ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint

This code works fine, but it exports all the slides into a unique pdf file.

Upvotes: 6

Views: 26862

Answers (4)

very_interesting
very_interesting

Reputation: 355

For me, the the accepted answer doesn't work. Also tried the fix suggested in the comment. Probably because I'm on Mac or sth.

I found this alternative question/answer which I tweaked to save each slide separately:

Sub each_slide_to_separate_pdf()

  'Hide all slides
  For i = 1 To ActivePresentation.Slides.Count
     ActivePresentation.Slides(i).SlideShowTransition.Hidden = msoTrue
  Next i

  'display each slide and save
  For i = 1 To ActivePresentation.Slides.Count
    'display current slide
    ActivePresentation.Slides(i).SlideShowTransition.Hidden = msoFalse

    'Save location
    Dim filePath As String
    filePath = "/Users/username/Documents/vba_folder" & i & "slide.pdf"
    ActivePresentation.SaveAs filePath, ppSaveAsPDF
    
    'hide the just saved slide
    ActivePresentation.Slides(i).SlideShowTransition.Hidden = msoTrue
  Next i

 'Show all slides again
 For i = 1 To ActivePresentation.Slides.Count
    ActivePresentation.Slides(i).SlideShowTransition.Hidden = msoFalse
 Next i

End Sub

Upvotes: 2

Ionyx Arts
Ionyx Arts

Reputation: 26

Sub ExportSlidesToIndividualPDF()
Dim oPPT As Presentation, oSlide As Slide
Dim sPath As String, sExt As String
Dim dlgOpen As FileDialog
Set oPPT = ActivePresentation

timestamp = Now()
sExt = ".pdf"

With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = -1 Then ' if OK is pressed
sPath = .SelectedItems(1)

With dlgOpen

For Each oSlide In oPPT.Slides
    i = oSlide.SlideNumber
    oSlide.Select
    oPPT.ExportAsFixedFormat _
    Path:=sPath & "\" & Format(timestamp, "yyyymmdd") & "_" & "Slide#" & i & sExt, _
    FixedFormatType:=ppFixedFormatTypePDF, _
    RangeType:=ppPrintSelection
Next

End With
End If

End With
Set oPPT = Nothing
End Sub   

I added an OpenFileDialogPicker, so you can choose the wishen location by yourself

Upvotes: 0

SDL
SDL

Reputation: 1

I discovered a fast / easy way to save individual slides in a ppt presentation as separate pdf files...nothing fancy...just a few steps... (1) right-click on the slide (as it appears in the left-hand column), select COPY (2) Left-Click on your bottom left Start button and open the PowerPoint program anew to a blank page (3) Right-Click in that blank doc and hit Paste (you may have an extra blank page at the top, just right-click and Cut it to get rid of it) (4) File / Save As / (select) PDF REPEAT the steps for each slide

Upvotes: -2

PatricK
PatricK

Reputation: 6433

You can do that: Below code will create pdf with adding the slide number at end of current folder, file name.

Sub ExportSlidesToIndividualPDF()
Dim oPPT As Presentation, oSlide As Slide
Dim sPath As String, sExt As String

Set oPPT = ActivePresentation
sPath = oPPT.FullName & "_Slide_"
sExt = ".pdf"

For Each oSlide In oPPT.Slides
    i = oSlide.SlideNumber
    oSlide.Select
    oPPT.ExportAsFixedFormat _
        Path:=sPath & i & sExt, _
        FixedFormatType:=ppFixedFormatTypePDF, _
        RangeType:=ppPrintSelection
Next
Set oPPT = Nothing
End Sub

Upvotes: 7

Related Questions