PowerPoint VBA prematurely exit loop slide show RRS feed

  • Question

  • I would like the loop to end prematurely when moving to the next or previous slide.

    Public Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow)
        Dim t As Date
        Dim s As Shape
        For Each s In Wn.View.Slide.Shapes
            If s.Name = "Textbox1" Then
                t = DateAdd("s", 10, Now())
                Do Until t < Now()
                    Wn.View.Slide.Shapes("Textbox1").TextFrame.TextRange.Text = Timer
            End If
        Next s
    End Sub

    Monday, May 6, 2019 6:10 PM

All replies

  • Hi,

    Since this case is related to VBA, in order to get more professional technical support, we recommend that you go to the development team.

    If you have questions about non-development Office, you can post to our forum in the future, we will be glad to help you.


    Bella Wu

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Tuesday, May 7, 2019 5:02 AM