我试图将宏放在一起,以便在运行它时,它会将幻灯片从模板演示文稿复制/粘贴到当前幻灯片之后的活动演示文稿中。我有90%的路在那里,但似乎不知道如何使粘贴部分发挥所需的作用。我所能找到的就是如何将它粘贴到指定的位置(例如幻灯片4)或演示文稿的末尾。
这是我到目前为止提到的MS资源:https://learn.microsoft.com/en-us/office/vba/api/powerpoint.slides.paste
这是我的代码的当前版本:
Sub PastefromTemplate()
Dim tgt, i%
'open the target presentation
'use path with the file if it is in a different location
Set objPresentation = Presentations.Open("source path")
'copy slide 1 from source presentation
'change the item number in order to target a different slide
objPresentation.Slides.Item(1).Copy
'paste the slide in target, currently set to slide 3
tgt = Array(3)
Presentations.Item(1).Slides.Paste tgt i
objPresentation.Close
End Sub谢谢你的帮忙!
发布于 2020-12-04 10:15:59
以下是解决办法,终于能够找到答案:
Sub Slide9()
Dim src As Presentation
Dim trg As Slide
Dim shp As Shape
Dim target As Presentation
'Copies slide (change # in Item(#)) from the source presentation
Set objPresentation = Presentations.Open("source file path")
objPresentation.Slides.Item(9).Copy
'Closes the source presentation
objPresentation.Close
'Go back to active presentation and paste, then go to pasted slide
With ActiveWindow.View
.Paste
.GotoSlide (ActiveWindow.View.Slide.SlideIndex)
End With
End Subhttps://stackoverflow.com/questions/65101179
复制相似问题