我需要为演示文稿的每张幻灯片生成一个 pdf 文件。
我正在使用以下代码:
ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\" & ActivePresentation.Name & ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint
Run Code Online (Sandbox Code Playgroud)
此代码工作正常,但它将所有幻灯片导出为唯一的 pdf 文件。
您可以这样做:下面的代码将创建 pdf,并在当前文件夹的末尾添加幻灯片编号,文件名。
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17662 次 |
| 最近记录: |