Cancel form close?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
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
 
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
 
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"
 
Back
Top