I am using the two modules below to add a slide to my presentation while it is in slide show mode. It works great, however I have run into an issue with it. It is being added to the end of the presentation instead of being inserted as the next slide where the macro is run (example, if run on slide 16, it should become the new slide 17):
Sub Example1() Dim Pre As Presentation Dim Sld As Slide Dim ttl As Integer ttl = numCorrect + numIncorrect Set Pre = ActivePresentation Set Sld = Pre.Slides.Add(Index:=Pre.Slides.Count + 1, Layout:=ppLayoutText) Sld.Shapes(1).TextFrame.TextRange = "Checkpoint Results" Sld.Shapes(2).TextFrame.TextRange = "Here are the results of the checkpoints in this module:" & vbNewLine & vbNewLine & _"Correct: " & numCorrect & vbNewLine & _"Total Questions: " & ttl & vbNewLine & _"Overall Score: " & (numCorrect / ttl) * 100 & "%" End Sub Sub Example2() ActivePresentation.SlideShowWindow.View.Last MsgBox "Please review documentation" & Chr(13) & "for any missed items!" & Chr(13) & Chr(13) & "Click OK to continue." Dim currentSlide As Slide Set currentSlide = ActivePresentation.SlideShowWindow.View.Slide ActivePresentation.SlideShowWindow.View.GotoSlide currentSlide.SlideIndex - 1 End Sub
Because of that, I am using the second Sub to call the slide (now last in the deck), hold it with a msgbox, and then go to the second to last slide (which was the last slide before Example1 ran) when the user clicks OK.
Its messy no doubt, so I am asking for help in cleaning it up. Here is what I am trying to accomplish:
- Add this slide next in line instead of to the end of the active slide show. This position will always be the second to last slide in the slide show, however the total number of slides in each deck will always vary.
- Instead of using the msgbox, I would prefer to programmatically add a command button captioned "Continue" that the user can click to move to the next slide.
Thanks in advance for any help!