Running Ontime's procedure while another function is running?

E

Enter The

Hi,

Is it possible to get the procedure called by onTime (which I'll refer
to as the onTime procedure) to run while another is still going?

My program needs to wait for the onTime procedure to complete and is
looping infinitely, with doevents, while it waits (please don't ask
why I'm doing this stupidity, it's due to a 3rd party tool). It would
run the onTime procedure, during the loop, earlier today. But this
afternoon it's just stopped. And the onTime procedure only runs if I
press the "stop" or "pause" buttons in VBA.

Thanks,

Enter
 
N

NickHK

According to Help on the OnTime method:
"LatestTime
Optional Variant. The latest time at which the procedure can be run. For
example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is
not in Ready, Copy, Cut, or Find mode at EarliestTime because another
procedure is running, Microsoft Excel will wait 30 seconds for the first
procedure to complete. If Microsoft Excel is not in Ready mode within 30
seconds, the procedure won't be run. If this argument is omitted, Microsoft
Excel will wait until the procedure can be run."

So, as I see it, unless you can put Excel into one of the required states,
OnTime will never fire.
You need to avoid the infinite loop or find another way to initiate that
code.
Maybe some event from this "3rd party tool" ?

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top