-
Take look at this code:
Code:
Sub Misc1()
For i = 1 to 10
Call Misc2 (i)
Next i
End Sub
Sub Misc2(Num)
Do ...
...
Doevents
Loop
End Sub
When I call Misc2 with parametr i, the Do..Loop cycle is started and the Next i clause is called after exiting Misc2.
How to force the program to call Misc2 and continue doing what it should do (not waiting to subroutine end)?
-
try inserting DoEvents in Misc1's For Next loop.
-
That won't work -- the problem is that your program has only one thread.
In a thread, only one thing happens at once, so execution of your program passes from one sub to another, completing everything on the way.
In order to do what you want you need to create another thread, but it's very iffy in VB. However, you can just-about simulate it by using an ActiveX DLL that's external to your program.
-
Do it like this.....
Code:
Sub Misc1()
For i = 1 to 10
Call Misc2 (i)
Next i
End Sub
Sub Misc2(Num)
Do
DoEvents
Loop Until DoEvents
End Sub
DocZaf
{;->