1

I have a windows forms application that uses excel to generate some reports. Untill now it used 2003 but i've made an upgrade to use 2007. I have installed on my machine 2003, 2007 and 2010, and my app references Microsoft.office.core, v 12.0 and microsoft.office.interop.excel v 12.0. But in my code, when i do :

using Excel = Microsoft.Office.Interop.Excel;
......
Excel.Application excelApp = new Excel.Application();
string v = excelApp.Version;

v will be 11.0 . Also, the path references

C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll

How can this happen? Any ideea how could i fix it ?

Thank you!

maephisto
  • 4,952
  • 11
  • 53
  • 73

2 Answers2

2

You shouldn't keep both versions (at least on your dev machine).On your clients machine it shouldn't be a problem . Normally in this situation your code should load the 2007 PIAs. I suggest that you should do a repair . Or do a complete fresh install of 2007.Or fiddle wth the registry and set the active version to 12 (which I don't recommend)

gawicks
  • 1,894
  • 15
  • 22
  • If you are developing applications for users you need to test with the versions they are using so you need access to the full set of versions. I am sure it was @Siddharth Rout who suggested installing each version on a separate virtual PC. Perhaps he will post an answer telling you how to do that. – Tony Dallimore Feb 29 '12 at 14:06
1

I've seen this topic lately, maybe it would be useful for you too: Trying to do Office Automation with Excel 2007, but keeps using Excel 2003.

Community
  • 1
  • 1
cookieMonster
  • 508
  • 6
  • 15