问题描述
我的任务是将一张幻灯片复制到多个 ppt 演示文稿.所有ppt都在同一个文件夹中.我不知道如何开始.到目前为止,我已经用 VBA 更改了一些简单的东西,如更改字体、标题等.有人可以帮助我吗?提前致谢
I have task to copy one slide to multiple ppt presentations. All ppts are in same folder. I don't have an idea how to start. So far I have change some simple stuff with VBA as changing font, title etc. Anybody can help me?Thanks in advance
推荐答案
使用采用这种形式的 InsertSlideFromFile 方法:
Use the InsertSlideFromFile method which takes this form:
.InsertFromFile(FileName, Index, SlideStart, SlideEnd)
示例.要从 test.pptx 复制幻灯片 3 到 4 并将它们粘贴到当前打开的演示文稿(ActivePresentation)的末尾:
Example. To copy slides 3 to 4 from test.pptx and paste them to the end of your currently open presentation (the ActivePresentation):
' VBA macro to insert slide(s) from file
' Written by Jamie Garroch of http://youpresent.co.uk/
Sub InsertSlides()
With ActivePresentation.Slides
.InsertFromFile "test.pptx", .Count, 3, 4
End With
End Sub
如果所有文件都在与打开的演示文稿相同的路径上,您可以通过以下方式自动设置路径:
If all files are on the same path as the open presentation, you can automate the path by starting with this:
Dim myPath as String
MyPath = ActivePresentation.Path
这里有关于 InsertSlideFromFile 方法的更多信息:
More info on the InsertSlideFromFile method here:
https://msdn.microsoft.com/en-us/library/office/ff746047.aspx?f=255&MSPPError=-2147217396
这篇关于将一张幻灯片复制到多个演示文稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!