Supporting Multiple Versions Of Excel

N

Nick Carter

I am automating Excel 2000 using the COM interop. I have noticed that the
application doesn't run with Excel 97. I want to write just one piece of
code which will work with both Excel 2000 and Excel 97. How can I do this
when they have different type libraries ? I could dynamically load the
relevant type library (i.e. Excel 2000 or Excel 97) on the target machine
and create my necessary objects (i.e. ExcelApplication and ExcelWorkbook)
using Activator.CreateInstance but this will return a System.Object. I think
that I would be unable to cast it into something useful (like an
ExcelApplication or ExcelWorkbook) because these types are dynamically
loaded from the type library.

Inpiration desired.

Nick Carter
 
H

Howard Kaikow

When creating an Office app that is to run on multiple versions, you have
two choices:

1. Build the app using the earliest library you wish to support.
2. Use late binding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top