Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to dynamically select which DLL to use (versions)

Status
Not open for further replies.

alistairpaul

Programmer
Apr 11, 2001
100
US
I have a small program that uses the MS Word 9 Object library.

All it does it use the Word.Application and Word.Document objects and their properties/methods. I don't care if the end-user has MS Word 97, or 2000.

How can I code the app to use the appropriate DLL, or exit if they have no MS Word installed? Right now, I just set a reference to the MS Word 9 Obj. Lib.

Thanks!! If my post was helpful, please Mark it below. Thanks! - Al
 
I debug using the reference but when compiling for release I get rid of the reference, use a conditional compile to use OBJECT instead of specifc definition, use constants for the wd... values.

Code:
#If blnRelease = True then
    Dim objAppl  as Word.Application
#else
    Dim objAppl  as object
#End if
Set objAppl = CreateObject("Word.Application")
This way you have a generic interface.
I also test out scenarios using VBS script tp "exercise" Office Applications. I get the code by recording macros inside Office and "porting" the code.
 
Do like John says, and link at runtime by typing your variable as an object. After doing a CreateObject against the Word ProgID ("Word.Application"), you can check it for Nothing to see if it suceeded.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top