Reputation: 610
Currently, I use the library for Excel 2010 but I need to install both 2003 and 2010 on my machine. How can I call Excel 2003 or 2010 in my code.
Edit: Maybe I didn't ask clearly. I want to use both applications in one project. So I want this to use Excel 2003 in some cases and in other 2010.
Excel.Application xlApp = new Excel.Application();
Upvotes: 2
Views: 851
Reputation: 28059
You can tell by the version number of the Interop library you use. 2003 is 12, 2010 is 15 (they skipped version 13) so after installing Office 2003 you can use the .Net tab in the Add References dialog box in Visual Studio to add the libraries for 12, test your code and then remove these and add the libraries for 15 and test your code again. The name of the library for 2003 is Microsoft Excel 12.0 Object Library, the name for 2010 is Microsoft Excel 15.0 Object Library.
Upvotes: 2