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

Add References in VBA

Status
Not open for further replies.

monsjic

Programmer
Jan 23, 2002
23
US
How can you check with code in VBA to see if a reference is present, and if it is not add it?
 
Which reference are you trying to Add? You can check the references like this:

Dim r As Reference, result as boolean
result = false
For Each r In Application.References
If r.Name = "reference your looking for" Then
result = true
End If
Next

If result is false after this, you can use the references.addfromfile statement to add the reference, you will need the full path to the reference you wish to add though...

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top