Interleave slides from several presentations
Problem
A visitor to the PowerPoint Newsgroup asked whether it was possible to combine slides from several different presentations one at a time to end up with something like this:
Presentation 1, Slide 1
Presentation 2, Slide 2
Presentation 3, Slide 3
Presentation 1, Slide 1
Presentation 2, Slide 2
Presentation 3, Slide 3
and so on.
Solution
Here's a little bit of code that'll stitch the presentations together as requested.
It's hardly the most efficient thing in the world, as it opens and closes each presentation many times, but the logic's easier to follow that way and as long as it's the computers's fingers getting tired and not ours, why worry?
Sub InterLeaveMe()
' Assumes you start with a new presentation based on same template as
' "component" presentations, new presentation already open when you run the macro
Dim oNewPres As Presentation
Dim oSamplePres As Presentation
Dim sPresBaseName As String
Dim x As Long
Dim y As Long
Dim lNumPresentations As Long
Dim lNumSlides As Long
' Edit these as needed
sPresBaseName = "c:\temp\Pres"
lNumPresentations = 3 ' number of presentations
lNumSlides = 3 ' number of slides in each pres
Set oNewPres = ActivePresentation
For x = 1 To lNumSlides
For y = 1 To lNumPresentations
Set oSamplePres = Presentations.Open(sPresBaseName & CStr(y) & ".PPT")
oSamplePres.Slides(x).Copy
oNewPres.Slides.Paste
oSamplePres.Close
Next
Next
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.