I assume the timer has got timer events queued up by the thousands. I still think the answer lies in DOEVENTS. Forget the Timer for now. If you insert the DOEVENTS command judiciously in the long series of routines, this allows Windows to see if there are any clicks awaiting processing. If so, they are processed. So if you click on the Stop Button, you can say Stop to the routine.
Do work1
DOEVENTS
IF NOT ThisForm.Stop
Do Work2
ENDIF
DOEVENTS
IF NOT ThisForm.Stop
Do Work3
ENDIF
FOR X=1 TO 100
DOEVENTS
IF NOT ThisForm.Stop
Do Work4
ENDIF
ENDFOR
>Charlie,
>Thanks for your advice. I am really trying to get a command button to stop a long series of routines from finishing, similar to the 'Phone dialer' in Windows. I know that the 'Escape' key will stop code from running. I have created a form with two command buttons ('RUN' and 'STOP') and a timer. I have set the timer Interval to 1/1000 of a second and a Wait Window with a Timeout of 5 seconds in the timer event. While the Timer is firing I can not click on the 'STOP' button to interrupt the Wait Window (the Wait Window simulates code running). Any advice?
Charlie