=?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.