首页 > 解决方案 > 我可以在 PowerPoint VBA 中使用“ActivePresentation”的替代方法还有哪些其他方法

问题描述

我目前正在研究 PowerPoint VBA 并编写代码以便能够复制第一张幻灯片并将其再次粘贴到同一个演示文稿中。但是,我不断收到错误“剪贴板为空或包含可能不会在此处发布的数据”,根据 Microsoft 页面,问题是使用“ActivePresentation”

我正在寻找另一种方法来引用我在不使用 ActivePresentation 的情况下打开的幻灯片。有什么帮助吗?想法?

我使用 ActivePresentation 的代码行如下:

ActivePresentation.Slides(1).Copy
ActivePresentation.Slides.Paste(ActivePresentation.Slides.Count=1)

标签: vbapowerpoint

解决方案


不要复制,复制

Dim NewSlide as Slide
Set newSlide = ActivePresentation.Slides(1).Duplicate
NewSlide.MoveTo toPos:=4  'move it to become the fourth slide

推荐阅读