SlideShowNextSlide Event

Microsoft PowerPoint Visual Basic

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

Private Sub application_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

application     An object of type Application declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Wn     The active slide show window.

Example

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
      Else
         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.

Note  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) = _
                     .Item(i).AnimationSettings.AnimationOrder
                     shpAnimArray(2, j) = i
                     j = j + 1
               End If
            Next
         End If
      End With
End Sub