How to solve “Unable to cast COM object of type Microsoft.Office.Interop.Excel.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Excel._Application’”

Recently I was working on a problem where a customer received that error message when trying to open a TFS work item list in Excel triggered from Team Explorer.

The error did not appear when opening Excel right away and accessing a TFS query.

I was checking Process Monitor to see what was going on underneath using the comparison technique that I learned from Mark Russinovich.

It turned out that Excel 2007 was installed and it’s COM Classes are registered in HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.6.

In contrast when Team Explorer wanted call Excel through COM automation it used HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.7.

Obviously TFS was trying to talk to Excel 2010 instead which was not present.

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 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 and Team Explorer work fine with that tiny little change.

My learnings: “When in doubt, run process monitor.” Smiley

Comments (5)
  1. AJ says:

    Thanks that helped. Had to do the same and it worked like a charm.

  2. Colin says:

    Awesome – solved my problem that I have been battling for hours – thanks!!!

  3. pavankumar says:

    Really worked out for me also…solved the issuse…thanks

  4. Alok says:

    Thanks. Helped me a lot

  5. Jeffry Altamar Thalliens says:

    Thanks man, solved my problem too after hours of digging, Thanks a lot

Comments are closed.

Skip to main content