Export each slide of Powerpoint to a separate pdf file

吃可爱长大的小学妹 提交于 2019-12-11 12:41:54

问题


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.


回答1:


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



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/17929124/export-each-slide-of-powerpoint-to-a-separate-pdf-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!