If you have different versions of MS-Office projects installed (e.g. Project 2016 and Excel 2013) on the same computer it will result in different versions of the MS-VSTO library being installed.
This is described in this Microsoft Developer Network (MSDN) blog:
http://blogs.msdn.com/b/dau-blog/archive/2012/04/20/how-to-solve-unable-to-cast-com-object-of-type-microsoft-office-interop-excel-applicationclass-to-interface-type-microsoft-office-interop-excel-application.aspx
"...So I rang the customer to discuss it further and it turned out that they installed Project 2010 to these boxes running Office 2007 that seemed to have added a newer automation class registry key for Excel and Word though even though it was not even installed.
Anyway, deleting the key HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.7 solved the issue for the customer.
Project, Excel, Word and Team Explorer work fine with that tiny little change
My learnings: “When in doubt, run process monitor.”...."
So, if you see this error, use the Windows Registry Editor (REGEDIT.EXE) and:
Remove the two keys for Excel:
- HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.8
- HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9
Then remove the two keys for Word:
- HKCR\TypeLib\{00020905-0000-0000-C000-000000000046}\8.6
- HKCR\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7
Then reinstall the MS-Office 2010+ add-in from our website, reboot and the issue will be resolved. You should no longer receive the COM error: