|
-
Oct 13th, 2000, 01:39 PM
#1
Thread Starter
Lively Member
Delay Code Execution
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]
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Oct 13th, 2000, 01:52 PM
#2
Add a DoEvents. This will do all the code events before processing to the next line after it.
-
Oct 13th, 2000, 01:55 PM
#3
Frenzied Member
Here's an example...
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
[Edited by seaweed on 10-13-2000 at 02:59 PM]
-
Oct 13th, 2000, 04:49 PM
#4
Thread Starter
Lively Member
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
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Oct 13th, 2000, 06:34 PM
#5
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.
-
Oct 13th, 2000, 07:22 PM
#6
Thread Starter
Lively Member
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
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Oct 14th, 2000, 06:17 AM
#7
Thread Starter
Lively Member
Thanks Matthew. It worked.
I placed the DoEvents in a Timer function / Do While
Loop.
0101011001000010
01101111011011100110110001101001011011100110010101110010
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|