从另一个 ppt 复制粘贴数据时出错

Error while copy-pasting data from another ppt

我正在尝试将幻灯片 1 从外部 ppt 复制到当前 ppt 到备注页中。但是,我收到此错误消息:

Slides (unknown member) : Invalid request. Clipboard is empty or contains data which may not be pasted here.

我正在复制的外部 ppt 确实包含数据。

VBA 脚本:

Sub copySlide()
Dim objPresentation As Presentation

Set objPresentation = Presentations.Open("/path/slides.ppt")

objPresentation.Slides.Item(1).Copy
Presentations.Item(1).Slides.Paste

objPresentation.Close
End Sub

试试下面的代码,希望你在 ("/path/slides.ppt") 的演示不会出错。

我添加了 2 个选项,要么将其放在末尾,要么作为第二张幻灯片 - 您可以轻松修改 Paste

代码

Sub copySlide()

Dim MyPres          As Presentation
Dim objPresentation As Presentation

Set MyPres = ActivePresentation
Set objPresentation = Presentations.Open("/path/slides.ppt")

objPresentation.Slides(1).Copy
'MyPres.Slides.Paste MyPres.Slides.Count + 1 ' <-- place it at the end
MyPres.Slides.Paste 2 ' <-- place it as the second slide

objPresentation.Close
Set objPresentation = Nothing ' clear object

End Sub