'Listing the selected slide index numbers

I have a large presentation and I'm looking to select a number of slides positioned a different positions and receive a list of the slide index numbers. My idea is for this list to appear in a message box.

So far I have put together the below which gives me each slide number in different message boxes. I'm looking for a list to appear in 1 message box that I can copy and paste into an email.

Ideally I'd like to add some extra text to the message box so I can copy and paste to a pre made email. I can probably take that part on though.

Any help would be greatly received.

Sub ShowMeSlideNumbers()

Dim oSld As Slide

For Each oSld In ActiveWindow.Selection.SlideRange

MsgBox "The slide index of the current slide is:" & oSld.SlideIndex

Next oSld

Exit Sub

End Sub


Solution 1:[1]

A simple mod of your existing code should do it:

Sub ShowMeSlideNumbers()

Dim oSld As Slide
Dim sTemp as string

For Each oSld In ActiveWindow.Selection.SlideRange

sTemp = sTemp & "The slide index of the current slide is:" & oSld.SlideIndex & VbCRLF

Next oSld

MsgBox sTemp

End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steve Rindsberg