vba 通过excel vba的powerpoint断开链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13840166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 18:47:28  来源:igfitidea点击:

powerpoint breaking links via excel vba

excelvbahyperlinkpowerpoint

提问by Philip

I am trying to update a PowerPoint Presentation with embedded charts via Excel by using a VBA script. This works fine with my code. The Problem is that I also want - after the charts have been updated - to break/remove the links to the Excle worksheet.

我正在尝试使用 VBA 脚本通过 Excel 更新带有嵌入式图表的 PowerPoint 演示文稿。这适用于我的代码。问题是我还想 - 在图表更新后 - 断开/删除指向 Excle 工作表的链接。

The code example shows my code also with the line that doesn′t work.

代码示例也显示了我的代码,其中行不起作用。

Any suggestion or solution would be highly appreciated!

任何建议或解决方案将不胜感激!

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

回答by Philip

thanks for the answers.

感谢您的回答。

I think I have solved the problem: The syntax of the breakline command was wrong. I had to address the slides and shapes directly:

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

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