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

Here’s a question from a reader:

As part of my quarterly report to management, I often need to copy several general information slides from other presentation. Not a big deal, but it would be a significant saver to be able to automate this exercise.  Any VBA help is appreciated!

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 import automation  could become a huge time savior!

Let’s get going:

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

Then go ahead and insert the following Macro into a VBA module in your destination presentation. All details about how to do that can be found in this 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 inserts predefined slides from one presentation to other
ActivePresentation.Slides.InsertFromFile FileName:="source.pptm", Index:=1, SlideStart:=2, SlideEnd:=4
End Sub

Let me know in case of any questions.


Leave a Comment: