When you need a timer for a larger interval than the Timer control allows, insert this code into a BAS module. The procedure starts when the timer interval has passed:
Dim lTimerId As Long
Private Declare Function SetTimer Lib "user32" _
(ByVal hWnd As Long, ByVal nIDEvent As _
Long, ByVal uElapse As Long, ByVal _
lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib _
"user32" (ByVal hWnd As Long, ByVal _
nIDEvent As Long) As Long
Private Sub TimerProc(ByVal lHwnd As Long, _
ByVal lMsg As Long, ByVal lTimerId As Long, _
ByVal lTime As Long)
Dim lResult As Long
lResult = StopTimer(lTimerId)
Call InsertYourProcessNameHere
'code to be executed after interval
End Sub
Public Sub StartTimer(lInterval As Long) _
'convert interval to milliseconds prior to
'passing
lTimerId = SetTimer(0, 0, lInterval, _
AddressOf TimerProc)
End Sub
Public Function StopTimer(lTimerId As Long) _
As Long
'must pass the TimerId returned by SetTimer
StopTimer = KillTimer(0, lTimerId)
End Function
This call executes the procedure:
Call StartTimer(5000) '5 seconds
You can stop the timer before the interval by calling the StopTimer function.