Exposing Excel

MTSkull

Well-known member
Joined
Mar 25, 2003
Messages
135
Location
Boulder, Colorado
I am trying to create an application to read data from an Excel file.

I have added a COM reference to excel using the reference add utility.
C#:
using Microsoft.Office.Interop.Excel;
I though this command would expose the excel commands to intellisense but that is not the case. Does doing the above make the excel stuff work even though it does not come up in Intellisense or am I missing a step?

MT
 
Excel interop article

A quick Google search revealed this interesting article (links to page 2). The article itself deals with creating Excel add-ons, but I would assume the basic stuff applies no matter what youre doing with Excel. Note that it mentions on page 1:

This technique only works with Office 2003. Older Office versions dont have the required functionality. When you install Office 2003, make sure you also include the .NET interoperability feature, because its key in creating add-ons.

I guess if youre using an older version of Excel youll need to inspect the types within the COM reference using the Object Browser (Ctrl+W,J). Not having Excel installed myself, I cant offer any specific advice on what to look for.

Good luck :cool:
 
Fixed...

C#:
using Excel = Microsoft.Office.Interop.Excel;

Just noticed this old post, this is how I fixed it, by setting the word "Excel" equal to the library name.

MTS
 
Back
Top