How to import and add slides into your PowerPoint presentation with VBA Macros?


Last updated: October 2019

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).

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.

Obviously, feel free to change the slide number indexing in the code so they’ll fit to your requirements.

Sub InsertFromOtherPres()
' This 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

You are able to make it loop through several presentations and insert specific slides from each into your management report.

This is just a simple example of PowerPoint automation. Readers looking for custom solutions, feel free to send an inquiry via the Contact page.

Hope it Helps :-)

Leave a Comment:

1 comments
Mick says September 10, 2018

Hi. Is it possible to keep the source formatting with additional code?

Reply
Add Your Reply