Thank you = try to repair your Office 365 in control panel. = WORKED
Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass'
Hi
I've this C# application which opens excel file and updated another excel file. The application developed in Visual studio 2005 and Office 2016.
I've recently uninstalled Office 2016 and installed Office 365. Since then " Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' " an error is generated (Image attached)
I've searched web but didn't get any idea on how to solve this error???
7 answers
Sort by: Most helpful
-
-
Daniel Zhang-MSFT 9,646 Reputation points
2021-02-05T06:05:00.023+00:00 Hi VenkataRamanaNori-1428,
This problem is mostly caused by incorrect COM Interop settings in the Windows registry. This can be caused by installing a newer version of Microsoft Office, and then removing it and installing an older version instead. There are other ways this could happen.
If this is not a code related error than please remove below given key from registry.
Please follow steps below:
Start-->Run --> regedit --> HKEY_CLASSES_ROOT-->TypeLib-->{00020813-0000-0000-C000-000000000046} --> 1.8/1.7 (Delete this)
If not successful, you can try to repaire your Office 365 in control panel. Then, try again. If the problem still exists, you can completely uninstall, reboot, and then reinstall Office.
Here are also some similar threads you can refer to.
unable to cast COM object of type 'microsoft.Office.Interop.Excel.ApplicationClass' to 'microsoft.Office.Interop.Excel.Application'"
How to solve “Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’”
How to solve “Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'”
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
-
IOSIF DOHI 11 Reputation points
2022-05-24T08:49:00.887+00:00 This problem appears after uninstall a MSOffice version, a restart is NOT made immediately and automatically a new install of a new version of MSOffice is done. The Windows registry is not cleaned up. Happily, after a restart is made, the Modify/Repair of MSOffice in Control panel/Programs and features solves this problem. Tried also for MSOffice 2007, 2021.
-
Ralk 11 Reputation points
2022-11-30T09:28:28.59+00:00 Working like a charm. This-> try to repair your Office 365 in control panel. = Worked!
-
Gary Gwynn 10 Reputation points
2023-03-27T13:55:13.51+00:00 and if you have a Mac and getting this what can you do.