How to build a delay into a code

A

Alex

Hi

I'd like to pause a Winword macro until a specific time. I tried something
like

Application.Wait Now + TimeValue("00:00:10")

and it came with the compilation error "Method or data member not found".
Is it only for Excel?

Besides, this seems to be a busy wait which blocks the PC, which I have to
avoid, because it will run on a Terminal Server.

Why "Application.Wait" doesn't work and what is a better way to build a
delay in the code?

TIA

Alex
 
T

Tony Jollans

Application.Wait is Excel.

In Word you can use Application.OnTime to fire a procedure at a given time.
With appropriate flags and jumps you could arrange to make it act like a
delay.
 
A

Alex

Thanks Helmut and Tony.

Sleep "kernel32" seems OK.

As to Application.OnTime , I was under the impression it is a busy wait,
but i'll check again.

Anyway, many thanks to both of you.

Alex
 

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