Do you mean pause the timer or stop it?
No, I don´t want to stop the timer, or pause the timer, I want to pause the
execution of the macro when the time is up until --for example-- a button is
pushed.
I will give an example to clarify myself:
When the Userform1 is activated (modal) , the timer is armed to close itself
after 10 seconds.
Userform1 has 2 buttons. CommandButton1 activates a MsgBox, and this one
prevents the timer from firing until the MsgBox is dismissed.
CommandButton2 opens another form, but does not prevent the timer from
firing, and result in an error message because it tries to unload the modal
form with a childform still open.
'These procedures are located on userform1
Private Sub UserForm_Activate()
'This Arms the timer to unload itself
Application.OnTime Now + TimeValue("00:00:05"), "closeThisForm"
End Sub
Private Sub CommandButton1_Click()
MsgBox "This will prevent the timer from firing until the OK button is
pushed"
End Sub
Private Sub CommandButton2_Click()
'This will not prevent the timer from firing,
'and result in an error message because the timer
'tries to unload the the modal form.with a childform still open
UserForm2.Show
End Sub
'This procedure to unload the form is located in a module
Private Sub closeThisForm()
Unload UserForm1
End Sub
What I am looking for, is a way to prevent the timer in Userform1 form
firing while child UserForm2 is still open.
So what code should I add to Userform2 so it prevents the timer on userForm1
from firing until this form is dismissed like MsgBox does.
Thanks.
Emile