hello i'm asking whether there are differences between the following lines, many thanks
Application.Wait Now + TimeValue("00:00:2")
sleep 2000
hello i'm asking whether there are differences between the following lines, many thanks
Application.Wait Now + TimeValue("00:00:2")
sleep 2000
Ciao!
I cannot find "sleep" as a valid statement or function. Where did you get it?
Sleep is an API function (and therefore won't work without the relevant declaration).
Remember what the dormouse said
Feed your head
you were right i happen to forget the declaration of api
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and i was asking if there are any differences between
sleep 2000
ofcourse with declaration
and the line
Application.Wait Now + TimeValue("00:00:2")
thankyou a lot
I think the answer to your question is that they are inherently the same. Preference will rule here.
However, if the purpose is to stop a macro so that you can do other tasks, it's not just a "pause for 2 seconds"... then you would use Application.OnTime. That would allow you to basically stop completely and get control back for a specified amount of time...then the macro (or another one) kicks off again at the appointed time.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Sleep is more flexible since it uses milliseconds (though I wouldn't actually expect it to be that accurate) but they do basically the same thing.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks