I still cant get any sleep Jerid


Posted by Joe C on October 05, 2001 11:55 AM

I was trying to use the sleep command to pause my macro till the mainframe could catch up, but it doesnt seem to be working, I think in part because the sleep comand causes the entire system to freeze and therefore RUMBA the mainframe interface does not accept my send keys. Is there a command simmilar to sleep but does not freeze Rumba from procesing the last send key.
Currently I am using the wait command but can only figure out how to use it to seconds.
Here is what I am using.
newhour = Hour(Now())
newminute = Minute(Now())
newsecond = Second(Now()) + 1
waittime = TimeSerial(newhour, newminute, newsecond)
Application.Wait waittime

Posted by faster on October 05, 2001 12:18 PM

sendkeys() has a wait parameter, you might try setting
it to TRUE



Posted by Jerid on October 08, 2001 4:30 AM

and you won't, as long as you work with computers.

I would try what faster suggested, even though it should work the other way. Do you send the keys and then sleep.

The Sleep function should only stop Excel (see description below)

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

The Sleep function suspends the execution of the current thread for a specified interval.

· dwMilliseconds
Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay.


This is what faster is talking about

SendKeys(Keys, Wait)
Wait Optional Variant. True to have Microsoft Excel wait for the keys to be processed before returning control to the macro. False (or omitted) to continue running the macro without waiting for the keys to be processed.