none
Wait macro in Word 2010 RRS feed

  • Question

  • I must be missing something really simple.  I am just trying to create a Word 2010 Macro that waits for a specified number of seconds before continuing. However I can't see how to do that in Word.  The VBA Command: Application.Wait does not seem to exist in Word.  Any hints?
    Sunday, April 5, 2015 8:00 PM

Answers

  • You could use the following procedure:

    Sub Wait(n As Long)
        Dim t As Date
        t = Now
        Do
            DoEvents
        Loop Until Now >= DateAdd("s", n, t)
    End Sub

    Call like this to wait for 10 seconds:

    Wait 10

    or

    Call Wait(10)


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Neil Weicher Sunday, April 5, 2015 10:32 PM
    Sunday, April 5, 2015 9:52 PM

All replies

  • You could use the following procedure:

    Sub Wait(n As Long)
        Dim t As Date
        t = Now
        Do
            DoEvents
        Loop Until Now >= DateAdd("s", n, t)
    End Sub

    Call like this to wait for 10 seconds:

    Wait 10

    or

    Call Wait(10)


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Neil Weicher Sunday, April 5, 2015 10:32 PM
    Sunday, April 5, 2015 9:52 PM
  • Thanks. That did the trick.

    Sunday, April 5, 2015 10:32 PM