ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remove a Reference (https://www.excelbanter.com/excel-programming/322081-remove-reference.html)

Scott

Remove a Reference
 
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



Rob Bovey

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




All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com