ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Refrerences which interfere (https://www.excelbanter.com/excel-programming/356404-vba-refrerences-interfere.html)

Gérard Ducouret

VBA Refrerences which interfere
 
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



Chip Pearson

VBA Refrerences which interfere
 
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




"Gérard Ducouret" wrote in
message ...
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





Tom Ogilvy

VBA Refrerences which interfere
 
Make the reference to the
"Microsoft Excel 9.0 Object Library"

same as you did for office.

--
Regards,
Tom Ogilvy


"Gérard Ducouret" wrote in message
...
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





Gérard Ducouret

VBA Refrerences which interfere
 
Chip and Tom,
Thanks a lot!

Gérard




All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com