This project has moved and is read-only. For the latest updates, please go here.

Excel Taskpane-Addin crashes Excel

Feb 2, 2016 at 1:00 PM
Hi,

I successfully created a Taskpane for my Addin (no problem here, Taskpane shows up and displays it's assigned UserControl).
My problem is that whenever I try to access the Excel.Application (or the COMApplication) Excel stopps responding and crashes with no Errormessage or Exception.

I've already tried and simplified my Addin to contain only a one-button Taskpane which initially worked. But after a few, seemingly unrelated, changes (stupid me did not create a backup/check-in) it stopped working and shows aforementioned behaviour.

My best guess is i messed up the ProgId and COMAddin fields...

Thanks
Feb 5, 2016 at 9:59 AM
Nevermind, doing this:
private void Connect_OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
    COMApplication = Factory.CreateObjectFromComProxy(null, Application);
    ExcelApplication = (NetOffice.ExcelApi.Application)COMApplication;
}
is a pretty bad idea to retive the Excel.Application. Using following code solved my Problem :)
private void Connect_OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
    ExcelApplication = new NetOffice.ExcelApi.Application(null, Application);
}