Cancel form close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to use the On Close event to display a message asking the user if
the really wants to exit. My MsgBox has vbYesNo, with the Yes clicked the
form closes, when the No is clicked I want to cancel the form close action
and leave the form open. Tried Cancel and other permutations without success.

Any ideas?

Thanks
 
You need the Unload event instead of the Close event. The Unload event has a
Cancel argument, set it to True to keep the form open.
 
Brendan

Spot on!

Thanks

Brendan Reynolds said:
You need the Unload event instead of the Close event. The Unload event has a
Cancel argument, set it to True to keep the form open.
 

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

Back
Top