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.
 
Back
Top