Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pausing subroutine

Status
Not open for further replies.

billheathco

Electrical
Joined
Sep 17, 2015
Messages
1
Location
US
Public Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub wait(ByVal dblMilliseconds As Double)
Dim dblStart As Double
Dim dblEnd As Double
Dim dblTickCount As Double

dblTickCount = GetTickCount()
dblStart = GetTickCount()
dblEnd = GetTickCount + dblMilliseconds

Do
DoEvents
dblTickCount = GetTickCount()
Loop Until dblTickCount > dblEnd Or dblTickCount < dblStart


End Sub

I found this in another post and it works. However, when I tried to use it, I found that all execution in any other subroutine also stops. I need to stop processing the current routine while others complete. Any help would be appreciated.
 
You could use Sleep

Code:
Public Declare sub Sleep Lib "kernel32" (ByVal ms as Long)

Public Sub wait(ByVal ms As long)
   for count = 0 to ms step 100
      DoEvents
      Sleep 100
   next
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top