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!

Set references by code 1

Status
Not open for further replies.

ruthcali

Programmer
Apr 27, 2000
470
US
Hello,

In Access97, how can i set references using code? I created a folder on the network drive called G:/MyReferences and copied MSOUTL85.OLB and EXCEL8.OLB into it.

Instead of going to each users's computer and clicking Tools, References, Browse and navigating to the G:/MyReferences folder, can i do that using code?

Thanks!

 
Daniel,
Wow. thanks!! that works.

Should i put 'on error resume next' before
Application.References.AddFromFile "path and filename"?

If not, i get a runtime error: 'name conflicts with exisitng module, project or object library'

Thanks!
 
Sorry, to clarify:

I get the runtime error if i run the code more than once. i plan on putting the code in the autoexec.bat macro so it runs everytime the user opens the database.
 
The error occurs because you try to add a reference that has already been added
You can Resume Next all right.
But you could also the collection:

For Each ref In Application.References
Debug.Print ref.Name & ": " & ref.FullPath
'Do your stuff with the name or path
Next

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Thanks Daniel!

My parents are from Romania! What a small world. They grew up around Bucharest.

I can understand Romanian and i can speak a little.


(i found your bio on the RentACoder webpage).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top