Cancel form close?

C

Craig Buchanan

Is there a way to cancel a close when the close occurs by clicking the X at
the top right corner of a form?

Thanks,

Craig
 
F

fredg

Is there a way to cancel a close when the close occurs by clicking the X at
the top right corner of a form?

Thanks,

Craig

Code the Form's Unload event:

Cancel = MsgBox("Are you sure you wish to close?",vbYesNo) = vbNo
 
X

x

Why not remove it from the Form, that way you don't have
to deal with this, and instead, put a "Close" button on
the Form.

In the Form property, set the "Close Button" property
to "No", that way it will be disabled. The way to
completely remove it is to set the "Control Box" to "No"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top