Hi all,
I have a small user form which shoes a countdown in seconds, then it closes and goes back to the main Routine and executes some staff (this repeates several times). Now my propblem, I have a cancel button on the form but I can not press it, resp. nothing happens, any idea why. I want to achieve that the cancel button aborts the countdown, closes the user form and goes back to the main program:
Thank you very much for your help ! Cheers Marc
I have a small user form which shoes a countdown in seconds, then it closes and goes back to the main Routine and executes some staff (this repeates several times). Now my propblem, I have a cancel button on the form but I can not press it, resp. nothing happens, any idea why. I want to achieve that the cancel button aborts the countdown, closes the user form and goes back to the main program:
Code:
Private Sub CancelBtn_Click()
' MsgBox ("Exit procedure cancel Btn....")
CancelBtn = True
Me.Hide
End Sub
Private Sub UserForm_Activate()
For iz = 1 To interval
Label2.Caption = interval - iz
If WaitingTime.CancelBtn Then ' MsgBox ("Exit procedure....")
iz = interval - iz
Unload Me
End If
Application.Wait (Now + #12:00:01 AM#)
WaitingTime.Repaint
Next iz
Unload Me
End Sub
Thank you very much for your help ! Cheers Marc
Last edited by a moderator: