PPT使用VBA导出pdf绘图

本文介绍了如何通过PPT的VBA宏一键导出pdf文件,详细步骤包括将pptx转换为pptm,使用Visual Basic新建模块并编写代码。在导出多张幻灯片为PDF时,需要注意文件命名的唯一性,以避免覆盖错误。文章还提及了官方提供的Presentation.ExportAsFixedFormat方法,并指出该方法中第三个参数的重要性。

一键导出pdf

  • pptx文件另存为pptm文件
  • 开发者工具,点击Visual Basic
  • 新建模块
  • 输入以下代码
  1. build module
    在这里插入图片描述

  2. select NO

  3. 将参数设置为ppPrintCurrent

  4. 将同一个ppt内多张slide转为多个pdf时,命名一定要各不相同,否则会报错

  5. 备注栏为不打印时应显示为单击此处添加备注 ,如果将多个slide变为空格,此时命名相同,报错

  • error
    在这里插入图片描述
  • correct
    在这里插入图片描述
Sub 逐张存储()
    'https://stackoverflow.com/questions/17929124/export-each-slide-of-powerpoint-to-a-separate-pdf-file
    Dim strNotes As String, savePath As String
    Dim oPPT As Presentation, oSlide As Slide
    Dim sPath As String, sExt As String
    
    Set oPPT = ActivePresentation
    'sPath = oPPT.FullName & "_Slide_"
    sPath = oPPT.Path
    sExt = ".pdf"
    
    For Each oSlide In oPPT.Slides
        i = oSlide.SlideNumber
        oSlide.Select
        strNotes = oSlide.NotesPage. _
            Shapes.Placeholders(2).TextFrame.TextRange.Text
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值