Accessing different versions of Excel VBA from another application

B

Bradley Dawson

I often run Excel VBA applications from AutoCAD, but the reference to Excel
is particular to the company's computer that I use. When it is run on
another computer with a different version of Excel, the application fails.
Is there a way to check for Excel versions and apply the correct application
reference?
 
B

Bill Barclift

Late binding WILL cause a perforance hit.....depending on your particular
application, this may or may not be acceptable. I would early bind and
reference an earlier version of Excel (like 97 or 2000, assuming you don't
use any features not supported by these apps). If the user has a new
version of Excel you will be fine.

Bill Barclift
 
B

Bradley Dawson

I like that, but the office computer is up to date and only references the
latest version, user's home computer's usually have older versions. Also,
once the program is run on a newer version, that seems to become the
reference and won't run on older versions.
Since I'm a newbie, I'll have to read up on this "binding" that I have
skipped over so much. Thanks for the help.
 
B

Bradley Dawson

Thanks Tom, these links will be my reading assignment! (Always wondered
what that binding thing was)
 
B

Bradley Dawson

Thanks, David. I have your site in my favorites under programming. I
should have looked there first.

David McRitchie said:
Hi Bradley,
msgbox "Excel Version = " & Application.Version
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

I often run Excel VBA applications from AutoCAD, but the reference to Excel
is particular to the company's computer that I use. When it is run on
another computer with a different version of Excel, the application fails.
Is there a way to check for Excel versions and apply the correct application
reference?
 
B

Bill Barclift

I would still approach it this way. Get a copy of someones older Excel type
library file called Excel8.olb or Excel9.olb. Put it on your computer (you
don't need to do anything with it, just get a copy of it) and reference it
before you save the Autocad file. This should work fine for your users. (I
haven't tried this in VBA but have done it many times in VB....I think it
should work fine in VBA, as well)

Bill Barclift
 
T

Tom Ogilvy

I don't believe the performance hit will be significant.

Microsoft is making the recommendation.
 
B

Bill Barclift

Sorry, apparently I did not communicate well.

The developer should get a copy of Excel8.olb or Excel9.olb and save it on
his/her computer. Then reference this in the Autocad macro file just before
saving, instead of their version of the Excel library. Redistribute this
copy to the user. Com will re-route the reference to the users version of
the Excel library just fine, as long the version of Excel is not older than
the version the developer referenced when the file was saved.

I tried this with AutoCAD 2002 and it worked just fine, just as it does in
VB6.

Bill Barclift
 
T

Tom Ogilvy

You communicated fine.
Apparently you didn't read what Bradley said very well.

The user opens the file in xl2002 at work and saves the file. The
references were then updated to xl2002 references. The user takes the file
home to work on excel 97, the file now doesn't work. Unlike a VB file.
 

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