Discussion:
How to build a delay into a code
(too old to reply)
A***@name.ext
2005-11-15 15:39:50 UTC
Permalink
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
Helmut Weber
2005-11-15 15:53:42 UTC
Permalink
Hi Alex,

there is no wait method for, at least Word 2003.

See (one line):

http://groups.google.de/group/microsoft.public.word.vba.general/browse_frm/thread/2da3ec34d799084b/c65fff652f61f0d8?lnk=st&q=wait+sleep+group:microsoft.public.word.vba*+author:helmut+author:weber&rnum=2&hl=de#c65fff652f61f0d8

http://groups.google.de/group/microsoft.public.word.vba.userforms/browse_frm/thread/8f61fdba80b62014/7796586a79857a6a?lnk=st&q=wait+sleep+group:microsoft.public.word.vba*+author:helmut+author:weber&rnum=1&hl=de#7796586a79857a6a
--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Tony Jollans
2005-11-15 15:55:03 UTC
Permalink
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.

--
Enjoy,
Tony
Post by A***@name.ext
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
Alex
2005-11-15 20:57:33 UTC
Permalink
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

Continue reading on narkive:
Loading...