none
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()
                
                    DoEvents
            
                    Wn.View.Slide.Shapes("Textbox1").TextFrame.TextRange.Text = Timer
            
                Loop
    
            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.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=officegeneral

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

    Regards,

    Bella Wu


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

    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