Open Excel Workbook

E

Ed

Like in a previous post by Matt, I too want to control Excel from Word.

Here's the problem: I program on a Word2003 machine.

'Microsoft Excel Object Library 11.0' is the reference I choose.

A few older computers at my disposal still use Word2002. On that 2002
computer, the library is '10.0'. When the VBA project is loaded, Library
11.0 is not recognized, and I get error messages, and the routine does not
load. (When I use a Word2007 computer, a switch is somehow made to load
Library 12.0, so going 'forward' works fine.)

Any thoughts? I know how to do late binding. Is that the only solution, or
is there a way to tell Word to use whatever Excel Object Library it can
find?

Ed (in Virginia)
 
J

Jonathan West

Ed said:
Like in a previous post by Matt, I too want to control Excel from Word.

Here's the problem: I program on a Word2003 machine.

'Microsoft Excel Object Library 11.0' is the reference I choose.

A few older computers at my disposal still use Word2002. On that 2002
computer, the library is '10.0'. When the VBA project is loaded, Library
11.0 is not recognized, and I get error messages, and the routine does not
load. (When I use a Word2007 computer, a switch is somehow made to load
Library 12.0, so going 'forward' works fine.)

Any thoughts? I know how to do late binding. Is that the only solution, or
is there a way to tell Word to use whatever Excel Object Library it can
find?

2 possible solutions

1. Use late binding.

2. On your development machine, use the earliest version of Office that you
intend to support, and set the reference there.

In both cases, there are sufficient differences between the ways Office
works in its different versions, that I would strongly recommend testing in
*all* the versions that you intend supporting. There may be cases where you
need to write a bit of version-specific code.
 

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