VBA PowerPoint无法保存演示文稿
我正在尝试将一个marco整合起来,它可以将Excel中的数据和图表添加到powerpoint模板中,并将其保存在一个目录中。正在从Excel运行宏 运行后,将显示以下消息:VBA PowerPoint无法保存演示文稿,vba,excel,templates,powerpoint,Vba,Excel,Templates,Powerpoint,我正在尝试将一个marco整合起来,它可以将Excel中的数据和图表添加到powerpoint模板中,并将其保存在一个目录中。正在从Excel运行宏 运行后,将显示以下消息: Run-time error '-2147467259 (80004005)': Presentation (unknown member): PowerPoint was unable to open or save this document. Please ensure that you have access p
Run-time error '-2147467259 (80004005)':
Presentation (unknown member): PowerPoint was unable to open or save this document. Please ensure that you have access priviliges to read or write the document that is not encrypted.
以下是VBA代码:
Sub CreateMPP()
Dim DestinationTemplate As String
Dim PowerPointApp As PowerPoint.Application
Dim myTemplate As PowerPoint.Presentation
DestinationTemplate = "C:\Users\Me\Documents\MPP_Template.potx"
Set PowerPointApp = CreateObject("PowerPoint.Application")
PowerPointApp.Visible = True
Set myTemplate = PowerPointApp.Presentations.Open(DestinationTemplate, ReadOnly:=msoFalse)
'Other macro that pulls the data and charts, which works perfectly fine
Call CreatePowerPointTest
myTemplate.SaveAs "TestTest", ppSaveAsPresentation
myTemplate.Close
PowerPointApp.Quit
End Sub
请尝试将msoTrue设置为只读?您将在哪里保存演示文稿?因为您没有提供路径(SaveAs),所以可能是在您没有写访问权限的文件夹中进行保存。@Jbjstam我已经尝试过了,但不幸的是,这并没有带来什么不同hanks@ShyamPillai!指定路径和文件名确实有效!