Changing Object Library references for older versions of Microsoft

G

Guest

I have an Acces-based vp application built with Microsoft Access/Word and Excel Object libraries that are version 10. I need to run this application on a desktop with version 9.0 of these object libraries. My code doesn't compile becuase the 10.0 object libraries are missing, and when trying to swap out my Object Libraries for the 9.0 versions the References dialog box doesn't allow it. Do I have to remove the associated objects/arguments in my application before I can delete the 10.0 Libraries and add the 9.0 Libraries, and then rebuild the code? Is there an easier way?
 
P

Paul Overway

You need to remove the reference(s) and use late binding instead. Late
binding allows you to degrade gracefully. See help for CreateObject. You
won't have Intellisense or predefined constants during development, but
you'll have less problems distributing your app.

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com


Linda said:
I have an Acces-based vp application built with Microsoft Access/Word and
Excel Object libraries that are version 10. I need to run this application
on a desktop with version 9.0 of these object libraries. My code doesn't
compile becuase the 10.0 object libraries are missing, and when trying to
swap out my Object Libraries for the 9.0 versions the References dialog box
doesn't allow it. Do I have to remove the associated objects/arguments in
my application before I can delete the 10.0 Libraries and add the 9.0
Libraries, and then rebuild the code? Is there an easier way?
 
J

JSand42737

=?Utf-8?B?TGluZGE=?= said:
I have an Acces-based vp application built with Microsoft Access/Word and
Excel Object libraries that are version 10. I need to run this application
on a desktop with version 9.0 of these object libraries. My code doesn't
compile becuase the 10.0 object libraries are missing, and when trying to
swap out my Object Libraries for the 9.0 versions the References dialog box
doesn't allow it. Do I have to remove the associated objects/arguments in my
application before I can delete the 10.0 Libraries and add the 9.0 Libraries,
and then rebuild the code? Is there an easier way?

Whenever you code with one of the external Microsoft libraries you run this
sort of risk.

The way that I do this is to create the code as you have done, and then switch
from early-binding, where you have a reference to the object library and use
something like 'Dim objXL As Excel.Application', to late-binding, where you
remove the reference to the object library, change your declarations to 'Dim
objXL As Object' and then 'Set objXL=CreateObject("Excel.Application")'.

You will also need to replace the built-in constants that you use with your
own. For example, xlThin is an Excel constant with a value of 2, so I would
declare a constant:

Const XL_THIN=2

Note that there may be a problem as you are developing with a newer version of
Word/Excel than is on the user's PC, as some of the Word/Excel VBA code may not
work in these earlier versions.
 
T

TC

But soooooooooo much slower! I didn't realize how much slower, until I ran
some timing tests on some existing production code. Certain method calls
were taking a tenth of a second, whereas locally (within the other
application) they were almost instantaneous. Makes a big difference, when
you repeat those methods thousands of times!

So when late binding, it is absolutely critical to absolutely minimize the
number of round-trips to the other program. A single round-trip eliminated,
can have a significant impact on performance. I've only just realized how
sinificant this is, when using late binding.

TC
 
G

Guest

Thanks for the info on late binding. I investigated this further, and I'm not sure that it will work for me in this case. Because I've written the code in VBA within a Access 2002 project, I can't work out how to delete the initial reference to the Access 10.0 Object Library that comes with this version. Do I have to delete these references with code, and then replace them with the run-time Access version's .OLB? I'm also experimenting with VB.net but can't seem to get late binding to work for Access there either. Thoughts?
 

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