Trap Cancel Button Without Using MessageBox Class
I have a file that opens automatically with an excelApp.Workbooks.Open statement, i.e., I'm not using MessageBox.Show. If the file is in use, I get the message, "'filenam' is being modified. Open as read-only", with OK and Cancel as options. I need to trap the "Cancel" option so I can take various actions if the user chooses this. But since I didn't use the MessageBox, class, how do I do this?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Guest UserRank #1,422 · 1.2K reputationPosted Jul 1, 2008, 10:43 AM EDT
HTH
Sunny Chen162 reputationPosted Jul 3, 2008, 4:42 PM EDT
I don't know if I understand your question correctly.
In your customized "MessageBox" dialog, put the "Cancel" button and set its "DialogResult" property to "Cancel". And in your caller form, coding as following (Suppose your "MessageBox" is MyDialog):
Hope this helps.
Tim Bostwick4 reputationPosted Jul 4, 2008, 7:16 AM EDT