[RESOLVED] Wait Method, is Microsoft example good??
I'm using the wait method in one of my macro.
I copied and pasted the exact example from the help file.
VB Code:
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
This is supposed to pause the macro for 10 second, but sometime it paused the macro for ever.
I'm wondering if this method is good. Because if the macro takes for example:
VB Code:
newHour = Hour(Now()) '=10
newMinute = Minute(Now()) '= 22
newSecond = Second(Now()) + 10 ' = 55+10 will equal 65 witch is 05
waitTime = TimeSerial(newHour, newMinute, newSecond) '=10:22:05
Application.Wait waitTime
But 10:22:05 is already passed by (the new wait time should be 10:23:05, is VBA wise enought to know that if seconds is higher thant 59 it needs to add 1 to minute???
Re: Wait Method, is Microsoft example good??
VB Code:
Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
'call it - its in milliseconds...
Sleep 10000 '10 seconds
Re: Wait Method, is Microsoft example good??