Consulting

Results 1 to 4 of 4

Thread: Lets try it again

  1. #1

    Lets try it again

    Through the use of debug and some other tests, I have determined that my "timer" code does work. However, the end results are not what I need. It appears that PowerPoint "waits" until a macro ALL code is completed before refreshing the slide.

    For example:
    Sub_1 has a time that runs for 10 seconds. Its purpose is to send various parameters to Sub_2 at 2 second intervals.

    Sub_2 uses the parameters to change objects and/or text on the slide.

    HOWEVER
    When the Sub_1 is run, it properly calls Sub_2 and sets the appropriate values, but the slide doesn't refresh until Sub_1 completes. On the attached example, I want each textbox to show the value as the value is calculated from sub_2. As it is, they all get displayed at the same time.


    Help!!!!!
    ttfn

    Kicker

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Hi Kicker
    Try adding a DoEvents inside the loop. See if that helps
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    Interesting -- I learned something (again ... )

    Private Sub CommandButton1_Click()
        Dim n As Long
        Dim tt As Single
        Dim st As Single
        For n = 1 To 5
        st = Timer
        Do While Timer < st + 1
        Loop
        Call show_start(n, Timer)
    Next n
    End Sub
    
    Private Sub show_start(ByVal vTime As Long, n As Single)
    Select Case vTime
        Case Is = 1
            Me.txtTest1.Value = n
        Case Is = 2
            Me.txtTest2.Value = n
        Case Is = 3
            Me.txtTest3.Value = n
        Case Is = 4
            Me.TxtTest4.Value = n
        Case Is = 5
            Me.txtTest5.Value = n
        End Select
    DoEvents
    End Sub
    Last edited by Aussiebear; 04-28-2023 at 01:19 AM. Reason: Adjusted the code tags

  4. #4
    Me Too. duh.....Sometimes I get overwhelmed with my own ignorance.
    thanks for the help
    ttfn

    Kicker

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •