Jaruzel.com

Pause for the Specified Time


'This will pause or timeout your applications code for the specified amount of milli-seconds.
'
'Declare a new DateTime variable and fill it with the current
'time with 2000 milli-seconds added to it.
Dim timeOut As DateTime = Now.AddMilliseconds(2000)

Do
'
'Keep the app from freezing and allow Windows to continue processing the applications messages.
Application.DoEvents()

'Keep looping until the elasped time of 2000 milliseconds.
Loop Until Now timeOut

MsgBox("The code paused for: 2000 Milli-Seconds or 2 Seconds!")