----------------------------------- Ashi_Mashi2 Sat Apr 30, 2005 11:56 am How to prevent the program from being closed? ----------------------------------- Hi guys, thanks for your previous helps....now, i want to set a msgbox "Are you sure you want to exit?(vbYesNo)" that would appear when the user tries to close/unload the program. That's easy using Form_Unload. But, when the user clicks on the "X" button at the top of the screen...i can set the msgbox to appear using form_unload, but if the user chooses "No" then it would still unload the form...is there a way to prevent it? or maybe i should use another command istead of form_unload :? ....anyway...thanks agian ----------------------------------- Brightguy Sat Apr 30, 2005 6:43 pm Re: How to prevent the program from being closed? ----------------------------------- Form_Unload has a Cancel variable passed to it (by reference). If the user chooses "No", then set Cancel to a nonzero value and the form will not unload. ----------------------------------- betaflye Mon May 02, 2005 7:28 pm ----------------------------------- Nice tip Brightguy