unable to cast COM object of type 'microsoft.Office.Interop.Excel.ApplicationClass' to 'microsoft.Office.Interop.Excel.Application'"

Microsoft Office 365

I was running Microsoft Office 365 with Windows 10 and tried the mentioned solutions to remove the registry key without success.

I went to the control panel in an attempt to repair the Office 365 suite. enter image description here

  1. Right Click on Start Menu
  2. Click Apps and Features
  3. Search Microsoft 365
  4. Click Microsoft 365
  5. Click Modify

I selected the quick repair enter image description here

Tried my program again and everything worked!


If this is not a code related error than please remove below given key from registry.

Steps:

Start--> Run --> regedit --> HKEY_CLASSES_ROOT-->TypeLib-->{00020813-0000-0000-C000-000000000046} --> 1.8/1.7 (Delete this)

Solution: This issue can be resolved by deleting an invalid registry key left over from the higher version of Office. Follow the above steps.

Cause: This issue is caused by a left over registry key if you have downgraded your version of Microsoft Office from either Office 2010 to Office 2007, or Office 2013 to Office 2010 or 2007.

Let me know if this solution is not helped to you


I am sure the answers to this question (and similar questions) proposing editing the registry and removing old references to versions of Office no longer on the machine are correct.

I am only adding this answer because I am currently kicking myself. Two hours spent hunting keys in the registry and getting nowhere. Last throw of the dice was to try a simple repair on Microsoft Office and suddenly my error is gone.

... seems to me it's worth trying a repair before getting too deep into manually editing the registry.


Windows 7 x64 / Office 365 (16.0.x) 32-bit / VS 2019

Was checked Registry ->HKEY_CLASSES_ROOT->TypeLib, look for {00020813-0000-0000-C000-000000000046} exist only one record "1.9", nothing else.

Checking problem by Process Monitor detecting possible problem with finding and reading from vbe6ext.olb(many results with "NAME NOT FOUND").

Was made "Quick Repair" from Repair Office from the Control Panel, after that problem is gone.

P.S> Was made checking "after treatment" by Process Monitor - now file VBE6EXT.OLB are taking from C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\ by first probe.


A machine had been updated to Office 2016 64-bit and the COM interface was throwing exceptions when called from the a 32-bit application. It did not have old TypeLib entries like the ones in Jayesh's answer.

Comparing ProcessMonitor traces to a working machine with Office 2016 led to what look like dead end registry keys in

HKEY_CLASSES_ROOT\Wow6432Node\TypeLib\{00024..

The working machine would check for the non-existent registry key and return

NAME NOT FOUND

The failing machine had the registry key but then would throw an exception shortly thereafter.

After repeatedly deleting the registry key, rerunning the trace, deleting the next failing key, the COM interface functionality was restored.