I was wondering about the best way to do this:
I have an app that works with the Excel DOM. Users may have either Excel 2003 or 2007 installed, I don't know which one a priori. Mine is a C# console app.
How can I make my app compatible with both? Is it possible at runtime to find what version and modify the Using statements accordingly? For example, I seem to remember that to use Excel 2003, I write Using Microsoft.Excel
, or just Excel
with the corresponding reference dll, but for 2007, I need Using.interop.Excel
or something like that... not to the point right now, but makes the problem clearer. Besides, many of the types of Excel 2003 are, well, not clearly defined (series
, for example, are Arrays
of Objetc
), while in 2007 some of them are more strongly "typed", etc.
I'd be happy to edit if the question is not yet clear enough.
Thanks.