View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default Remove a Reference

"scott" wrote in message
...
Code 1 adds the ADO 2.6 Library fine. Can someone tell me how code 2
should read to remove the ADO 2.6 Library? I found CODE 2 as example on
web, but wasn't sure how it could be changed.
CODE 1
Application.VBE.ActiveVBProject.References.AddFrom File _
"C:\Program Files\Common Files\System\ado\msado26.tlb"
CODE 2
Set x = Application.VBE.ActiveVBProject _
.References.Item("Project2")
Application.VBE.ActiveVBProject.References.Remove x


Hi Scott,

Here's one way to do it:

Sub RemoveReference()
Dim x As Object
Set x = Application.VBE.ActiveVBProject _
.References.Item("ADODB")
Application.VBE.ActiveVBProject.References.Remove x
End Sub

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm