首页 > 解决方案 > 使用 excel VBA 将 Powerpoint 保存为 PDF

问题描述

当我尝试运行下面的代码时,我收到“运行时错误 '13' 类型不匹配”错误消息。它在我尝试导出为固定格式的第 6 行代码中提供错误。

Sub Button5_Click()

Application.DisplayAlerts = False

 ActiveWorkbook.SaveAs FileName:="P:\SFO-CSIM-Dept\Risk-Mgmt\SubAdvised\20" & Range("F14").Value & "\InvRisk_" & Range("F15").Value & "_USE4L_Risk Report_" & Range("F14").Value & ".xlsm"

 Set PowerPointApp = GetObject(class:="PowerPoint.Application")

 PowerPointApp.ActivePresentation.SaveAs FileName:="P:\SFO-CSIM-Dept\Risk-Mgmt\SubAdvised\20" & Range("F14").Value & "\InvRisk_" & Range("F15").Value & "_USE4L_Risk Report_" & Range("F14").Value & ".pptx"

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

 Application.DisplayAlerts = True 

End Sub

我在这里先向您的帮助表示感谢!

标签: vbapdfpowerpointsave-as

解决方案


推荐阅读