How to arrange a 5 second pause

This seems juvinile but you can have 30 points for it.
I need to make my app pause 5 seconds (variable) when a button is pressend before the action takes place.
I tried a for x = 1 to ??? but that varies depending on processor speed.
I know that timers time things but I can't figure out how to make one pause my app. (If thats the way to do it)
rbendAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

watyCommented:
Use the sleep API

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

0
EDDYKTCommented:
use sleep aPI call
0
watyCommented:
again
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

EDDYKTCommented:
waty, today is not my date!

Hopefully it won't happen three times in a row.

8-<
0
watyCommented:
I sawyou responded a questio before me, so I let you :)
0
deightonprogCommented:

Dim dTime1 As Date
   
   
    dTime1 = Now
    Do
        DoEvents
    Loop Until DateDiff("s", dTime1, Now) >= 5

    MsgBox "bonjour"
0
mark2150Commented:
Faster yet:

public sub WaitForIt(Delay as integer)

dim donetime

donetime = timer + delay

do while timer < donetime
  doevents
loop

End Sub

M
0
rbendAuthor Commented:
deighton seems to have the least complicated answer to my need.
Please answer deighton.
And thanks to all of you for taking the time.
0
deightonprogCommented:
Dim dTime1 As Date
                         
                         
                        dTime1 = Now
                        Do
                            DoEvents
                        Loop Until DateDiff("s", dTime1, Now) >= 5

                        MsgBox "bonjour"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mark2150Commented:
You can use the new "Accept Comment as Answer" feature to award points without waiting for answerer to respond...

M
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.