Link to home
Start Free TrialLog in
Avatar of ocortesmx
ocortesmx

asked on

Microsoft.Office.Interop.Excel Fails

Hello,
I installed the Office 2013 RC and then uninstalled. Now when I run a Windows Application developed in C# using visual studio 2008 I get the following error:

Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' 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

I know the code is correct because I have been using it for a long time and I know the problem is with the Interop.Excel that it is messed up but I don't know how to fix it. I have upgraded excel on my machine from 2003 to 2010 I still have Access 2003 installed and Publisher 2007 along with the Office 2010.
I tried to repair the office installations (2003,2007,2010) and reinstall the PIA for 2003 and 2010 but no luck.
Any help on how to clean the references and make it work will be appreciated.
Regards,
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ocortesmx
ocortesmx

ASKER

Hello,
I was checking the GAC and I see the following entries:

Microsoft.Office.Interop.Excel v.15
Microsoft.Office.Interop.Excel v.14

Policy.11.0.Microsoft.Office.Interop.Excel v. 15
Policy.11.0.Microsoft.Office.Interop.Excel v. 14
Policy.12.0.Microsoft.Office.Interop.Excel v. 15
Policy.12.0.Microsoft.Office.Interop.Excel v. 14
Policy.14.0.Microsoft.Office.Interop.Excel v. 15
Policy.14.0.Microsoft.Office.Interop.Excel v. 14

Should I uninstall some of them? I need the application to export to Excel 2003 and above like it was doing before. Actually it still works on the machines that I deploy the application, it is just on my development machine that it stopped working but I am affraid that if I create a new version of the program now that it is not working on my machine the other machines will be confused too.
Thanks for any help.
"I'd suggest de-installing office, running a registry cleaner (there are numbers available on the internet) then reinstalling office."

Thanks for the suggestion but I will need to uninstall office 2003, 2007, and 2010 and then reinstall them and I am not sure that I want to do that. I am hopping that there is another way to fix the problem.
I would still recommend doing what I suggested.  You could try deleting things but it might not work or even makes things worse.


(I know it is a bit late - but trying beta software on your development machine without a complete backup <I'd even say clone the hard disc> is not a good idea).
What version PIA are you using? 2003? Try just reinstalling 2003.
I did the uninstall the used CCleaner to clean the registry and finally started on safe mode and uninstalled all the office entries in the GAC. After I installed office 2003 and everything worked fine then installed office 2010 and everything seem to be working fine.
Thanks a lot!