Don't Allow Modal Dialogs to Go Behind Excel Windows
The move in Excel 2013 to use an SDI instead of an MDI has caused some rather serious problems with modal dialogs. There are many ways this can bite you, but the easiest one to describe in this forum is this:
- Open Excel 2013 or 2016
- Make sure there are two different workbooks open and maximize both their windows.
- Go to VBA and in the immediate window type MsgBox "X" and execute it.
- The display switches back to the active spreadsheet and there's a "X" in a modal dialog on top of it, as expected.
- Now in the Windows taskbar, choose to bring forward the other workbook.
- It comes forward but you can't interact with it because there is still a modal dialog up which is now behind the visible spreadsheet.
- For all intents and purposes, Excel is frozen until you realize you need to go back to the other spreadsheet and get rid of the modal dialog.
Like I said, if you are smart enough to remember there was a dialog up in front of that other window, you can always go back to the task bar and select the other Excel and close it... The problem is often my customers often don;t remember there was a dialog up (or maybe there were 10 workbooks open... and they can't remember which one it was) and they often end up having to kill Excel via the task manager and start over.
This got to be a big enough problem that I wrote an external asynchronous timer that identified this situation had happened, and I brought the appropriate window forward for them. But this is a huge pain to do.
I would love if this could be fixed!
Jasmine Lee commented
I have this problem as well. Mutiple worksheets just come over to top and cover the dialog box, which makes users think the dialog has disappeared. This happens event we have set the dialog as a modal dialog!
Jan Karel Pieterse commented
This is indeed a problem I have received feedback about from customers. I'd love the messagebox (or any other modal form) to stay on top of all Excel windows.
Hi Ken... Thanks for your response. "Not sure how your customers can forget about a message box that appears right in their face and that they explicitly ignore. Sounds like they need to pay more attention to what they are doing." Well it's not just simple MsgBoxes that do this... that was just the simplest example I could post. Any modal dialog is in the same boat. So imagine my customer gets one of my modal dialogs and say "oh... I need to look up XYZ in my email to get the answer to that dialog's query..." They go to Outlook, get their info. Then they click on the task bar to go back to Excel... but they click the wrong workbook in the taskbar because they aren't paying attention to that detail. So now Excel comes up with the modal dialog behind. Excel won't respond and the user can't figure out what happened. As far as they can tell Excel is just frozen now.
I really DO want a modal dialog in my app... but I want it to work properly.
Kenneth Barber commented
I found a few resources on the Internet.
Create a non-modal UserForm (Windows & Mac):
Create a non-modal message box (Windows only):
Not sure how your customers can forget about a message box that appears right in their face and that they explicitly ignore. Sounds like they need to pay more attention to what they are doing.