View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Object Library References Question

Use late bound code, don't set a reference and createobjects rather than new
them.

Show the code and we can probably convert it to late-bound for you.

--
__________________________________
HTH

Bob

"mcambrose" wrote in message
...
What do you do about macros that will run on machines with different
versions
of something such as Excel. For instance I created a database macro on a
machine with Office 2007, so I set a reference to the Excel 12.0 library
using the Visual Basic editor. When I opened the file on an Office 2003
machine and tried to run the macro I had an error. I found that the Excel
11.0 library was the only one available. I removed the reference to Excel
12.0 library and selected the Excel 11.0. It then worked as planned. Is
there
a way to change this object library refernce in code based on what Office
version is being used? I have an example of how to look through the
references collection, so I know I could change those items, but I
wouldn't
necessarily know the exact path to use for the object library on a
different
machine. Thanks for any insight provided. If this is too complex to give a
full explanation you might just tell me it can be done, but not worth the
trouble. THanks.