Application.SlideShowNextSlide event (PowerPoint)

Occurs immediately before the transition to the next slide. For the first slide, occurs immediately after the SlideShowBegin event.


expression. SlideShowNextSlide(Wn)

expression An expression that returns an Application object.


Name Required/Optional Data type Description
Wn Required SlideShowWindow The active slide show window.


For information about using events with the Application object, see How to: Use Events with the Application Object.


This example determines the slide position for the slide following the SlideShowNextSlide event. If the next slide is slide three, the example changes the type of pointer to a pen and the pen color to red.

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

   Dim Showpos As Integer

   Showpos = Wn.View.CurrentShowPosition + 1

If Showpos = 3 Then  

         With ActivePresentation.SlideShowSettings.Run.View

            .PointerColor.RGB = RGB(255, 0, 0)

            .PointerType = ppSlideShowPointerPen

         End With


         With ActivePresentation.SlideShowSettings.Run.View

            .PointerColor.RGB = RGB(0, 0, 0)

            .PointerType = ppSlideShowPointerArrow

         End With

      End If

End Sub

This example sets a global counter variable to zero. Then it calculates the number of shapes on the slide following this event, determines which shapes have animation, and fills a global array with the animation order and the number of each shape.


The array created in this example is also used in the SlideShowNextBuild event example.

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

   Dim i as Integer, j as Integer, numShapes As Integer

   Dim objSld As Slide

   Set objSld = ActivePresentation.Slides _
        (ActivePresentation.SlideShowWindow.View _
        .CurrentShowPosition + 1)

      With objSld.Shapes

         numShapes = .Count

         If numShapes > 0 Then

            j = 1

            ReDim shpAnimArray(1 To 2, 1 To numShapes)

            For i = 1 To numShapes

               If .Item(i).AnimationSettings.Animate Then

                  shpAnimArray(1, j) = _

                     shpAnimArray(2, j) = i

                     j = j + 1

               End If


         End If

      End With

End Sub

See also

Application Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.