Use a form-level Boolean variable Running to tell the procedure when to stop. The RunLongProcess subroutine is the long process in this example. It periodically calls DoEvents to let the program process button clicks and then checks Running to see if it should still be running.
The CmdStart_Click event handler checks Running to see if the long process is currently running. If the process is running, the user is trying to stop the process so the program sets Running to False to tell RunLongProcess to stop.
If the process is not running, the user is trying to start it. The program sets Running = True and calls RunLongProcess.