|
-
Jun 29th, 2006, 09:30 AM
#1
Thread Starter
Addicted Member
[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???
-
Jun 29th, 2006, 11:49 AM
#2
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
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jun 29th, 2006, 12:11 PM
#3
Thread Starter
Addicted Member
Re: Wait Method, is Microsoft example good??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|