powerpoint打破链接通过excel vba

我正尝试使用VBA脚本通过Excel更新embedded式图表的PowerPoint演示文稿。 这与我的代码正常工作。 问题是,我也希望 – 图表更新后 – 打破/删除链接到Excle工作表。

代码示例显示我的代码还与不工作的行。

任何build议或解决scheme将不胜感激!

Function RefreshPPT() Set PPT = CreateObject("PowerPoint.Application") PPT.Visible = True PPT.Presentations.Open "Name.pptx", Untitled:=msoTrue PPT.ActivePresentation.UpdateLinks PPT.ActivePresentation.BreakLinks ------ this line doesn´t work PPT.ActivePresentation.SaveAs Filename:="Name2.pptx" PPT.Quit Set PPT = Nothing End Function 

感谢您的答案。

我想我已经解决了这个问题:breakline命令的语法是错误的。 我不得不直接解决幻灯片和形状:

 PPT.ActivePresentation.Slides(i).Shapes(s).LinkFormat.BreakLink