I am using an Excel VSTO add-in that displays some modal dialogs. These dialogs do not appear as native windows on the Windows taskbar. But under certain circumstances, these dialogs do not disappear from the top of Excel and cannot return using the taskbar!
The whole story (reproduced with Windows XP - 7, Excel 2007 - 2010):
- I open Excel and create two or more new books.
- I show a modal dialog, say, through "MessageBox.Show" I open the notepad and enlarge its window
- I am trying to activate one of excel workbook windows through taskbar windows
- I expect: Excel will come up with my modal MessageBox to the top
- Actual result: neither MessageBox, nor any of the Excel workbooks appear when you click a workbook item in the Windows taskbar!
Why???
I can activate Excel with Ctrl + Tab. Then my modal dialog / MessageBox will be correct from above. This is easy to reproduce if you have Visual Studio and Excel. Please, help!
Greetings, JΓΆrg
Sample Code:
- Just create an empty Visual C # add-in / Office / 2010 / Office 2010
- Replace the contents of "ThisAddIn.cs" with the following code:
-
namespace ExcelAddIn6 { public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { NativeWindow excelWindowThatIsTheOwner = null; try {
source share