How can I delay the execution of the next line of
code for 5 seconds WITHOUT pausing the application?
Thanks.
[Edited by VBonliner on 10-13-2000 at 02:44 PM]
Printable View
How can I delay the execution of the next line of
code for 5 seconds WITHOUT pausing the application?
Thanks.
[Edited by VBonliner on 10-13-2000 at 02:44 PM]
Add a DoEvents. This will do all the code events before processing to the next line after it.
[Edited by seaweed on 10-13-2000 at 02:59 PM]Code:Public Sub Wait(afSeconds As Single)
Dim lfTimesUp As Single
Dim llNumDays As Long
Dim ldDaysUp As Date
lfTimesUp = Timer + afSeconds
Do While lfTimesUp > 86399
lfTimesUp = lfTimesUp - 86399
llNumDays = llNumDays + 1
Loop
ldDaysUp = Date + llNumDays
Do Until Date = ldDaysUp
DoEvents
Loop
Do Until Timer >= lfTimesUp
DoEvents
Loop
End Sub
I have a CLOSE statement after a PRINT statement.
I need to hold the execution of the CLOSE till
the printer's 'buffer' gets the document.
The DoEvents (inbetween PRINT and CLOSE)
is holding the printer as well and causing problems.
Any ideas?
Thanks
You shouldn't have any problems with a DoEvents between PRINT and CLOSE. But what is the problem you are having? Because a DoEvents will PRINT and wait for that task to finish and then CLOSE.
I am sorry Matthew, the problem is from QUIT application
not CLOSE document. I tried the DoEvents as below, but
it didn't work; I still get the message if I wanna
quit word while a print job is pending.
PRINT document
CLOSE document
DoEvents
QUIT application
Thanks Matthew. It worked.
I placed the DoEvents in a Timer function / Do While
Loop.