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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling linkage of libraries (.dll etc.) programatically?

Status
Not open for further replies.

KenMcd4

Technical User
Feb 6, 2002
12
US
Does anyone know a way to control the linking of reference libraries (in other applications) from within VBA? Here's the problem: I have a large VBA application for Excel; our primary platform is Windows NT 4.0. Recently, we started converting new PCs to Windows 2000. When the VBA app is opened on a W2K machine, it's looking for a link (for instance) to an Adobe Acrobat library, acrobat.tlb. As established via the VBA "Tools," "References" menu, the app expects to find acrobat.tlb on a particular user drive, and in a particular folder. W2K users now have drive C: as the primary drive, whereby Windows NT users have drive D: as the primary drive. Some users have Acrobat version 4.0, while others have version 5.0. So, long story short, when any user tries to load and run the app, an error message is displayed because VBA can't find (and link to) the acrobat.tlb file. The user has to go into the VBA editor, manually deselect the previous reference to acrobat.tlb, and select a new one (i.e., the location of the file on that PC). I'd like to be able to do this from the auto_open( ) procedure, by detecting where the acrobat.tlb file is located on that machine (this part I can handle), then creating a VBA link to that file, and removing any links that point to a non-existent file (on that machine). Any ideas? Thanks...

Ken McDaniel
 
I have a demo on my website on handling missing and broken references. The VBA is open and available. You might find it useful.


From the downloads section download References.zip "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
Thanks, Neal...
I'll see how much of this approach I can apply to Excel VBA. Doing a little research, I discovered the "References" collection and the "Reference" object, with related "add" & "remove" methods (and an "IsBroken" property). Something within these keys should work.

Ken McDaniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top