Excel crashes when launched from embedded doc in Word doc

Oct 22, 2013 at 11:00 AM

I've got a combined VSTO + ExcelDNA addin deployed using ClickOnce, it all works fine.
Except today when a bug got reported that Excel will crash at startup when it's loaded from an Excel file embedded in a Word document.
The error is occuring when making the following call ExcelComAddInHelper.LoadComAddIn(comAddin); in IExcelAddin.AutoOpen.
If an Excel instance is already loaded and I click on the embedded document it's fine, the issue only appears if the new instance of Excel is started from loading the embedded document.
I'm happy as a limitation to not load up the ExcelDNA based part in that situation but I wouldn't know how to identify the context of the startup (from or not from an embedded Excel document).

Thanks in advance for your help
Oct 24, 2013 at 1:09 PM
You might like to investigate the Application.Creator and Application.UserControl properties.

Oct 30, 2013 at 5:59 PM
I managed to make a workaround by checking Application.UserControl during startup time of the VSTO addin.
If this is returning false, ie Excel is created via CreateObject or GetObject which I guess is the case when loading an Excel document when embedded then I don't try to register the XLL.
Application.Creator would be returning the same screen during the various scenarios I tested.