Last updated: June 2020
Applicable to: Office 2019 and older. Windows only.
Here’s a question from a reader:
As part of my quarterly report presentation to management, I often need to copy several general information slides from other presentations. Not a big deal, but it would be a significant saver to be able to automate this exercise. Any VBA Macro help to accomplish that is appreciated!
As you just mentioned, you can automate the slides copy and paste in PowerPoint using Visual Basic for Applications. If you need to create several presentations every month, this slide copy / import automation could become a huge time saver!
PowerPoint VBA for adding slides
Let’s get going with this simple exercise.
First off, ensure that your development tab is enabled and visible. Here’s how to do that.
I’ll assume that you have already created a Macro enabled presentation (file type is .pptm), that you have placed in the same directory than your source presentation (which I’ll refer to as source.pptm). Here’s how to create a PowerPoint presentation with VBA.
First off, let’s take a backup of that presentation (simple copy and save).
Then let us go ahead and insert the following Macro into a new VBA module in your destination presentation. All details about how to do that can be found in our PowerPoint VBA tutorial.
Here’s the VBA code that you’ll need in order to automatically copy and paste the slides.
Couple of assumptions I made:
- Your source presentation is named source.pptm
- You’ll paste slides 2-4 from your source presentation
- You’ll place the copied slides starting slide 5.
Sub InsertFromOtherPres() ' This short VBA macro copies slides from one presentation and inserts them into another ActivePresentation.Slides.InsertFromFile FileName:="source.pptm", Index:=1, SlideStart:=2, SlideEnd:=4 End Sub
Obviously, feel free to change the slide number indexing in the code so they’ll fit to your requirements.
You are able to make it loop through several presentations and insert specific slides from each into your management report.
PowerPoint VBA for duplicating slides
Instead of copying slides to another presentation you might want to clone one or more slides in your presentation:
Sub CopySlides() ' Short snippet to duplicate the third slide in a presentation, change the index/es accrodingly ActivePresentation.Slides(3).Duplicate End Sub
Those were just a couple of simple example of PowerPoint automation. Readers looking for specific questions, feel free to send an inquiry via the Contact page.
Hope it Helps 🙂
1 thought on “How to copy add slides into your PowerPoint presentation with VBA Macros?”
Hi. Is it possible to keep the source formatting with additional code?