Use End instead of Call cmdExit_Click. If you have some complex code in there, than put that code in a Module so you can re-use it anywhere.