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!

controlling references in a excel 2000 to XP to 2000 app

Status
Not open for further replies.

mbarron1

Technical User
Jan 31, 2003
2
US
Here's the short description of the problem: I need to be able to check to see if a reference exist to Word 9.0 object library, and, if it doesn't, create it. I've seen some previous notes on programatically creating references, but they require either the guid for the reference (which I can't find for the word 9.0 library) or the file location (which could vary if users installed office to a non-default directory). Any idea how to do this?

Here's the long description: I have an excel 2000 app that uses early binding to word to create some reports. This has always worked fine and dandy until recently when users have started using the app on a machine with office XP and then trying to use it again on a machine with office 2000). It works fine when the program is run in XP, all Microsoft turns all the 9.0 references to 10.0 references and all is right with the world. But when they try move back to 2000, the reference does not revert. Instead I've now got an oh-so-useless references to "MISSING: WORD 10.0 OBJECT LIBRARY". I don't want to go back through and have to rewrite the program using early binding. So is there a way to have excel check which reference exist and use the appropriate one?

I've seen the MS note at but again, since I can't find the guid (perhaps someone could tell me how to find it), and I don't think it's safe to hard code the path, I'm not sure if that will help me.

Thanks in advance,
Martin Barron
 
Set a reference to Word manually and run the following code, which should return the Guid and the path to the appliaction.

You should then be able to use either to set the reference.

Code:
Dim refVBE
For Each refVBE In ThisWorkbook.VBProject.References
    Debug.Print refVBE.GUID, refVBE.FullPath
Next refVBE
Set refVBE = Nothing

Have you considered late binding ?

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top