0

We have a word based application. We create a Word Addin & when trying to connect the addin using the statements :

Microsoft.Office.Core.COMAddIn MyAddin = null;
            bool bFound = false;
            try
            {
                foreach (Microsoft.Office.Core.COMAddIn MyAddin1 in WordApp.COMAddIns)
                {
                    MyAddin = MyAddin1;
                    if (MyAddin.Description == "My ComAddin")
                    {
                        MyAddin.Connect = true;
                        bFound = true;
                        break;
                    }
            }
         }

Just as the code hits the line MyAddin.Connect = true; it throws the below exception:-

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in MyWordApp.exe Additional information: Error in the DLL (Exception from HRESULT: 0x800401F9 (CO_E_ERRORINDLL)) & the Word application quits after this.

I googled to find some resolution to this but to no help. Can anyone help me on this to avoid the exception.

Thanks/Saurav.

4

0 回答 0