RE: Stopping macro execution without generating an error message....
This code displays a userform every 5 seconds
This button on the sheet - the traditional way - stops the code from displaying the form but generates an error message "Run time eror 1004 Method onTime of object Application.onTime failed" , because it "breaks" code execution, not stops or ends it:
There must be a simple way to stop the execution without breaking the code which will
always generate an error message,, but I can't figure it out.
Can anyone's help on this.
Thanks, cr
This code displays a userform every 5 seconds
Code:
t = Now() + TimeSerial(0, 0, 5)
Application.OnTime t, "RepeatMSG"
And the macro which displays the form:
Sub RepeatMSG()
Userform.Show
t = Now() + TimeSerial(0, 0, 5)
Application.OnTime t, "RepeatMSG"
End sub
This button on the sheet - the traditional way - stops the code from displaying the form but generates an error message "Run time eror 1004 Method onTime of object Application.onTime failed" , because it "breaks" code execution, not stops or ends it:
Code:
Private Sub CmdStopMsg_Click()
Application.OnTime t, "RepeatMSG", , False
End Sub
There must be a simple way to stop the execution without breaking the code which will
always generate an error message,, but I can't figure it out.
Can anyone's help on this.
Thanks, cr