View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joe HM Joe HM is offline
external usenet poster
 
Posts: 92
Default How to dynamically add/change Reference?

Hello -

I have some code in Excel where I open up a Word Document ...
Set lFileObject = CreateObject("Scripting.FileSystemObject")
Dim lWordApplication As Word.Application
Dim lWordDocument As Word.Document
....

I have the Microsoft Word 11.0 Object Library added under Tools
References to make this work. The problem is that at my company there
are still some machines with Word 10.0. Right now I need two different
versions of the Excel file, once with the reference to 11.0 and one
with the reference to 10.0.

Is there a way I can automatically add the reference based on which
version of Word is installed?

Thanks!
Joe