How does msgbox stop the OnTime event?
This way UserForm1 never closes if CommandButton2 is clicked.
And in case of the MsgBox, Userform1 closes after the MsgBox is dismissed.
In other words, MsgBox keeps the timer from firing until it is dismissed.
Thanks.
Emile
Perhaps:
Regular Code Module:
Public dFireTIme As Double
UserForm1:
Private Sub UserForm_Activate()
dFireTime = Now + TimeSerial(0, 0, 5)
Application.OnTime dFireTime, "closeThisForm"
End Sub
Private Sub CommandButton2_Click()
Application.OnTime dFireTime, "closeThisForm", Schedule:=False
UserForm2.Show
End Sub
UserForm2:
Private Sub UserForm_Deactivate()
Application.OnTime Now + TimeSerial(0, 0, 1), "closeThisForm"
End Sub
|