lynnnow
08-17-2013, 12:12 AM
I have a piece of code that checks for the system time and shows a countdown timer at a particular hour... I can set up the timer to run at periodic intervals but I can't seem to figure out why the "Schedule:=False" part fails. Please help me understand why it is failing. See code below
Sub ReRunCheckTime()
ReRunTime = Time + TimeSerial(0, 0, 15)
'Debug.Print Time & vbTab & ReRunTime
If Time >= TimeValue("23:57:00") Then
If frmCountDownTimer.Visible = False Then
frmCountDownTimer.Show 0 'This is the form that is shown
Application.OnTime ReRunTime, "ReRunCheckTime", , False 'This is where it fails
End If
End If
Application.OnTime ReRunTime, "ReRunCheckTime"
End Sub
I've looked up the help files and seen examples on various fora for an understanding on this but don't understand why it should bug out. Should the cancel ontime be in a different sub? If so, why?
Sub ReRunCheckTime()
ReRunTime = Time + TimeSerial(0, 0, 15)
'Debug.Print Time & vbTab & ReRunTime
If Time >= TimeValue("23:57:00") Then
If frmCountDownTimer.Visible = False Then
frmCountDownTimer.Show 0 'This is the form that is shown
Application.OnTime ReRunTime, "ReRunCheckTime", , False 'This is where it fails
End If
End If
Application.OnTime ReRunTime, "ReRunCheckTime"
End Sub
I've looked up the help files and seen examples on various fora for an understanding on this but don't understand why it should bug out. Should the cancel ontime be in a different sub? If so, why?