Announcement

Collapse
No announcement yet.

VBA Wait method

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBA Wait method



    I want excel to wait 2-3 seconds before it calls the next procedure but for some reason, after it calls the first procedure it just gets hung and I have to control break.

    Application.Wait ("00:00:02")

    Any suggestions???

  • #2
    The Wait method waits until the time specified. In your case you're asking Excel to wait until it is 2 seconds after midnight before resuming. Try the following:

    Application.Wait (Now() + "00:00:02")

    This tells Excel to wait until 2 seconds have passed from the time the functions is called.

    akhon - Toronto / Ontario / Canada

    Comment


    • #3
      Wait needs to know the time it is to wait until, not how long to wait. Try
      Application.Wait now+timevalue("00:00:02")
      Please do not U2U (private message) me directly for questions that should be posted to the forum; any such U2Us will be ignored.

      Comment


      • #4
        I recieve a type mismatch error...

        Comment


        • #5
          Derk's Way works.

          That's a pretty cool feature.

          Comment


          • #6
            thanks for all your help

            Comment


            • #7


              Re: VBA Wait method

              Originally posted by tratliff View Post
              I recieve a type mismatch error...
              If you are using Option Explicit youŽll get this message. Try to Convert the String Value to Date:


              application.Wait (Now() + CDate("00:00:02"))

              Regards

              Comment

              Working...
              X