VBA Refrerences which interfere

G

Gérard Ducouret

Hello,
In MS Project 2003, I have a VBA procedure which reads a database and
imports the data into Project.
The VBA References are :
- Visual Basic For Applications
- OLE Automation
- Microsoft Office 9.0 Object Library
Everything is working well until now.

I add a new VBA procedure which exports data toward Excel (version 2003 on
my PC)
So I create a new VBA Reference on "Microsoft Excel 11.0 Object Library".
Every thing works fine on my PC which is running Excel 2003.
But on all the other PCs in the Company, which are running Excel 2000,
nothing works anymore. Even the first procedure which doesn't use Excel!
Where this problem is coming from ? What I have to do so that every VBA
procedure works with every Excel version ?
Thanks ahead for your help!

Gérard
 
C

Chip Pearson

Excel references are not necessarily downward compatible. Your
reference to version 11 doesn't "downgrade" to earlier versions
of Excel. If you have Excel 2000 on your machine, use that as a
reference. If you don't, you have to use "Late Binding", which
means that you need to change every reference to an Excel object
to As Object. So instead of

Dim Rng As Excel.Range
change to
Dim Rng As Object


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
T

Tom Ogilvy

Make the reference to the
"Microsoft Excel 9.0 Object Library"

same as you did for office.
 

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