简体   繁体   English

将一张幻灯片复制到多个演示文稿

[英]Copy one slide to multiple presentation

I have task to copy one slide to multiple ppt presentations. 我的任务是将一张幻灯片复制到多个ppt演示文稿中。 All ppts are in same folder. 所有ppts都位于同一文件夹中。 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? 到目前为止,我已经使用VBA更改了一些简单的内容,例如更改了字体,标题等。有人可以帮助我吗? Thanks in advance 提前致谢

I found this VBA code that may help you get started. 我发现此VBA代码可能会帮助您入门。 This will copy all of the slides from the first presentation to a second presentation using a loop. 这将使用循环将所有幻灯片从第一个演示文稿复制到第二个演示文稿。 You can modify the code to copy a single slide and then past into multiple presentations with the loop. 您可以修改代码以复制一张幻灯片,然后使用循环将其复制到多个演示文稿中。

Sub main()
Dim objPresentation As Presentation
Dim i As Integer

'open the target presentation
Set objPresentation = Presentations.Open("C:\2.pptx")
For i = 1 To objPresentation.Slides.Count
objPresentation.Slides.Item(i).Copy
Presentations.Item(1).Slides.Paste
Next i
objPresentation.Close
End Sub

For example, if you open the target PPTX presentation and run the following VBA macro, it will copy the first slide out of the 2.pptx presentation file and paste it into the current target PPTX. 例如,如果您打开目标PPTX演示文稿并运行以下VBA宏,它将从2.pptx演示文稿文件中复制第一张幻灯片并将其粘贴到当前的目标PPTX中。

Sub copySlide()
Dim objPresentation As Presentation

'open the target presentation
'use path with the file if it is in a different location ("c:\2.pptx")
Set objPresentation = Presentations.Open("2.pptx")

'copy slide 1 from 2.pptx presentation
'change the item number in order to target a different slide
objPresentation.Slides.Item(1).Copy

'paste the slide in target
Presentations.Item(1).Slides.Paste

objPresentation.Close
End Sub

Use the InsertSlideFromFile method which takes this form: 使用采用以下形式的InsertSlideFromFile方法:

.InsertFromFile(FileName, Index, SlideStart, SlideEnd)

Example. 例。 To copy slides 3 to 4 from test.pptx and paste them to the end of your currently open presentation (the ActivePresentation): 要从test.pptx复制幻灯片3到4,并将其粘贴到当前打开的演示文稿(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

More info on the InsertSlideFromFile method here: 有关InsertSlideFromFile方法的更多信息,请参见:

https://msdn.microsoft.com/en-us/library/office/ff746047.aspx?f=255&MSPPError=-2147217396 https://msdn.microsoft.com/zh-cn/library/office/ff746047.aspx?f=255&MSPPError=-2147217396

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Powerpoint幻灯片:如何将我在一张幻灯片上的组合框和文本框控件复制到另一张相同演示文稿的幻灯片上? - Powerpoint slides: how to copy my combobox and textbox controls on one slide to a another slide, same presentation? 将基于特定单词的幻灯片复制到新的演示文稿 - Copy slide based on specific words to new presentation 如何在演示模式下 Select 多个文本框,将它们复制并粘贴到另一张幻灯片 - How To Select Multiple TextBoxes In Presentation Mode, Copy & Paste Them To Another Slide 是否可以检查一个PowerPoint演示文稿中的幻灯片是否与另一个套牌中的幻灯片相同? - Is it possible to check if a slide in one PowerPoint presentation is the same as a slide in another deck? Select 基于幻灯片标签的 Powerpoint 幻灯片并复制到新的演示文稿中 - Select Powerpoint slides based on the slide tags and copy into a new presentation 使用输入框将一个 PowerPoint 演示文稿的图形复制并粘贴到另一个 PowerPoint 演示文稿 - Copy and paste graph of one PowerPoint presentation to another PowerPoint presentation with inputbox 在另一个 Powerpoint 演示文稿中嵌入来自其他 Powerpoint 演示文稿的幻灯片的链接副本 - Embed a linked copy of a slide from other Powerpoint presentation in another Powerpoint presentation 如何根据特定的幻灯片输入将幻灯片从现有演示文稿复制到新演示文稿? - How to copy the slides from existing presentation to new presentation based on the specific slide input? 从Excel调用宏以打开PowerPoint演示文稿,插入幻灯片以及将范围复制到幻灯片有时会起作用,但会出错 - Macro called from Excel to Open a PowerPoint Presentation, Insert a Slide, and Copy Range to Slide works sometimes, errors others 在 PowerPoint 演示文稿中复制幻灯片 - Duplicating a slide in PowerPoint presentation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM