Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I recently updated office from 2003 to office 2007. I also updated a C# project that works with excel sheets and discovered that it no longer works in office 2003. In the error message, I got the following message "Unhandled exception has occurred in your application....Could not load file or assembly Microsoft.Office.Interop.Excel...or one of its dependencies"
Is there any way to make it work for both office 2003 and 2007?
Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 8-May-11 3:06am    
Sad... Must die!
--SA
yesotaso 8-May-11 8:20am    
"Automation is a black-art"...

hello there
Not sure is that gonna work or notbut if you install the PIA for the Office 2007 and again debug the application then may be your problem will be resolved because the Excel 2007 PIA is backward compatible with PIA for office 2003. Important links for this are below :

download for the PIA for MS Office 2007 :
http://www.microsoft.com/downloads/en/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en[^]

what is Primary Interop Assemblies (PIAs):
http://msdn.microsoft.com/en-us/library/aa302338.aspx[^]

http://stackoverflow.com/questions/2239472/trying-to-do-office-automation-with-excel-2007-but-keeps-using-excel-2003[^]

may help you with the problem
best regards
 
Share this answer
 
The solution that eventually worked for me was to delete all references to Microsoft office from the project and then add Microsoft.Office.Interop.Excel anew. But to select the previous version (11 and not 12 )and then to compile again. In the Bin directory a Microsoft.Office.Interop.Excel.dll was created. It is essential that the dll will reside near the *.exe file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900