Sometimes my excel Addin gets disabled if it ends up being in the disabled COM Addins I can enable it with the following code. However if it ends up in disabled items I can't enable it using this code. Is there a way I can enable a disabled item. Not sure if I could do it using regedit or not.
I get a COM exception {"Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))"}
xl.Application myApp = new xl.Application();
foreach (COMAddIn currentAddIn in myApp.COMAddIns)
{
if (currentAddIn.Description == "Create Excel AddIn" && !currentAddIn.Connect)
{
try
{
currentAddIn.Connect = true;
}
catch (Exception)
{
CommonMethods.ExceptionHandler("Create tab couldn't be enabled", new StackTrace(true).GetFrame(0).GetFileLineNumber(), new StackTrace(true).GetFrame(0).GetMethod());
}
break;
}
}
return false;
}