Quantcast
Viewing all articles
Browse latest Browse all 12583

How to close a message box when a form is cancelled?

Hi folks,

apologies if this has been asked before, I have not been able to find anything relevant, but may have missed something.

In a MS Word 2010 VBA form I have several mandatory fields that are checked for completion by an 'On exit' event. My problem is that is a user tabs into one of these fields and then before entering any data decides to give up and cancels the form, the message box is still displayed and left hanging. Further, when the user clicks on the message box to close it the systems complains because it can no longer find the next bit of code to execute.

How can I check for, and close, any open message boxes when the form is exited using 'Cancel'. Alternatively is there a better way of achieving the same functionality? 

thanks

Viewing all articles
Browse latest Browse all 12583

Trending Articles