Problems targeting any version of Excel

L

Larry Lard

I'm using VS.NET 2003 and attempting to create an app that can talk to
any version of Excel from 5.0 onwards. On my dev machine I have Office
2002 (Office XP) installed. This obviously provides an EXCEL.EXE that
exposes the Excel 10.0 Object Library. I also have in my Office install
area this file:

XL5EN32.OLB

which is registered as "Microsoft Excel 5.0 Object Library". But when I
add an interop reference to this, and examine it in Object Browser, I
see that it seems to be extremely 'naively' implemented - all the
methods and properties and so forth are present, but the only TYPE used
is OBJECT. Whereas the 10.0 type library is strongly-typed throughout.

I have confirmed this using the old OLE VIEW application. For example:

XL5EN32.OLB Workbooks.Open:

VARIANT Open(
VARIANT Filename,
VARIANT UpdateLinks,
VARIANT ReadOnly,
VARIANT Format,
VARIANT Password,
VARIANT WriteResPassword,
VARIANT IgnoreReadOnlyRecommended,
VARIANT Origin,
VARIANT Delimiter,
VARIANT Editable,
VARIANT Notify,
VARIANT Converter);

EXCEL.EXE (version 10.0) Workbooks.Open:

HRESULT Open(
[in] BSTR Filename,
[in, optional] VARIANT UpdateLinks,
[in, optional] VARIANT ReadOnly,
[in, optional] VARIANT Format,
[in, optional] VARIANT Password,
[in, optional] VARIANT WriteResPassword,
[in, optional] VARIANT IgnoreReadOnlyRecommended,
[in, optional] VARIANT Origin,
[in, optional] VARIANT Delimiter,
[in, optional] VARIANT Editable,
[in, optional] VARIANT Notify,
[in, optional] VARIANT Converter,
[in, optional] VARIANT AddToMru,
[in, optional] VARIANT Local,
[in, optional] VARIANT CorruptLoad,
[in, lcid] long lcid,
[out, retval] Workbook** RHS);

Now, although using XL5EN32.OLB I *can* write an app that will work
with Excel versions from 5.0 up, while actually *writing* it I get no
intellisense, no strong typing, in fact I am effectively using late
binding and As Object variables all the way through, which is going to
be a PAIN.

So... what I am after is an Excel 5.0 type library with strong typing.
OR in fact since 5.0 is not an absolute requirement, simply the
*earliest* Excel type library with strong typing. I can get hold of old
Offices; which one should I go for?

TIA,
 

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