Exceptions from Excel API after downgrading from 2013 to 2010

1

After downgrading from Excel 2013 to 2010 (i.e. removing 2013 and installing 2010) when I try to access the Excel OM from my add-in like this:

if (this.Application.ActiveWorkbook == null)
{
    return;
}

I get the following Exception:

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

I have taken the following steps to resolve the issue but none have worked:

  • Repaired the office installation
  • Uninstalled and reinstalled
  • Cleared out all office 15 references from the registry
  • Re-registered Excel ("C:\Program Files (x86)\Microsoft Office\Office14\excel.exe" /o)

However, nothing seems to work. Is there something I'm missing or do I actually have to wipe the machine?

EDIT: My guess is that there is still come conflict in the registry but I have no idea where...

Thanks in adv!

c#
excel
visual-studio-2010
asked on Stack Overflow Oct 8, 2014 by Pat Mustard • edited Oct 8, 2014 by Pat Mustard

1 Answer

2

Found the solution - I forgot to remove one reference to Excel 2013:

HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}\1.8

After removing 1.8 my corrected registry looks like this:

enter image description here

...

enter image description here

Credit: http://www.c-sharpcorner.com/Forums/Thread/203666/unable-to-cast-com-object-of-type-microsoft-office-inte.aspx

answered on Stack Overflow Oct 8, 2014 by Pat Mustard • edited Oct 8, 2014 by Pat Mustard

User contributions licensed under CC BY-SA 3.0