Hello again,
I have two possible solutions for you, and you can choose which way you want to go based on your requirements.
For my first test, I created two PPTX files and saved them to a temporary folder on my desktop. We have A.pptx and B.pptx.
I then opened up a new PP file and added the following code to it. Make sure to change the paths to both of your PPTX files.
VBA Code:
Sub MergeAndAlternateSlides()
Dim sourcePresA As Presentation
Dim sourcePresB As Presentation
Dim targetPres As Presentation
Dim sourcePathA As String
Dim sourcePathB As String
Dim sourceSlide As Slide
Dim targetSlide As Slide
Dim i As Long
Dim targetIndex As Long
' Set the paths to your A.pptx and B.pptx files
sourcePathA = "C:\path\to\A.pptx"
sourcePathB = "C:\path\to\B.pptx"
' Open the source presentations
Set sourcePresA = Presentations.Open(sourcePathA)
Set sourcePresB = Presentations.Open(sourcePathB)
' Create a new presentation to hold the merged slides
Set targetPres = Presentations.Add
' Merge and alternate slides
For i = 1 To sourcePresA.Slides.Count
' Copy slide from A.pptx
sourcePresA.Slides(i).Copy
targetIndex = (i - 1) * 2 + 1
targetPres.Slides.Paste targetIndex
Set targetSlide = targetPres.Slides(targetIndex)
targetSlide.Shapes.Title.TextFrame.TextRange.Text = "A" & i
' Copy slide from B.pptx
sourcePresB.Slides(i).Copy
targetIndex = targetIndex + 1
targetPres.Slides.Paste targetIndex
Set targetSlide = targetPres.Slides(targetIndex)
targetSlide.Shapes.Title.TextFrame.TextRange.Text = "B" & i
Next i
' Close the source presentations without saving
sourcePresA.Close
sourcePresB.Close
End Sub
Hit the F5 button to run the code, and this is what pops up.
View attachment 87866
You can see that each slide is alternated like you requested, but it does so with a text label added to each slide. You may have to zoom in to see them.
Another option is to use the "notes" section of each slide. After running this script, the labels (A1, B1, A2, B2, etc.) will be added to the "Notes" section of each slide in the merged presentation. To view these labels while editing your presentation, click on the "Notes" button in the status bar at the bottom of the PowerPoint window or press Ctrl + Shift + H to show the "Notes" pane. The labels will not be visible when presenting the slides.
VBA Code:
Sub MergeAndAlternateSlides()
Dim sourcePresA As Presentation
Dim sourcePresB As Presentation
Dim targetPres As Presentation
Dim sourcePathA As String
Dim sourcePathB As String
Dim sourceSlide As Slide
Dim targetSlide As Slide
Dim i As Long
Dim targetIndex As Long
' Set the paths to your A.pptx and B.pptx files
sourcePathA = "C:\path\to\A.pptx"
sourcePathB = "C:\path\to\B.pptx"
' Open the source presentations
Set sourcePresA = Presentations.Open(sourcePathA)
Set sourcePresB = Presentations.Open(sourcePathB)
' Create a new presentation to hold the merged slides
Set targetPres = Presentations.Add
' Merge and alternate slides
For i = 1 To sourcePresA.Slides.Count
' Copy slide from A.pptx
sourcePresA.Slides(i).Copy
targetIndex = (i - 1) * 2 + 1
targetPres.Slides.Paste targetIndex
Set targetSlide = targetPres.Slides(targetIndex)
targetSlide.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text = "A" & i
' Copy slide from B.pptx
sourcePresB.Slides(i).Copy
targetIndex = targetIndex + 1
targetPres.Slides.Paste targetIndex
Set targetSlide = targetPres.Slides(targetIndex)
targetSlide.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text = "B" & i
Next i
' Close the source presentations without saving
sourcePresA.Close
sourcePresB.Close
End Sub
View attachment 87867
You'll see in the second picture, that no additional text was added to the slides, but the slide designations appear in the Notes at the bottom of the screen. There is no way that I know of to physically change the labels on the far left side of the slide bar. PowerPoint manually gives each slide a sequential number (1, 2, 3, 4, 5, etc.).
Hope this is what you're looking for. If not, let me know, and I can try something else.
Chris