Getting System.Runtime.InteropServices.COMException on trying to register word addin

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.

c#
com
ms-word
comexception
office-addins
asked on Stack Overflow Dec 11, 2013 by Saurav Mishra • edited Dec 12, 2013 by Saurav Mishra

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0