Sub RemoveReference()
For Each Ref In Application.VBE.ActiveVBProject.References
' Debug.Print Ref.Name
If Ref.Name = "My_Project" Then Application.VBE.ActiveVBProject.References.Remove Ref
Next
End Sub
Sub AddReference(): Found = False
For Each Ref In Application.VBE.ActiveVBProject.References
Debug.Print Ref.Name
If Ref.Name = "My_Project" Then Found = True
Next
If Not Found Then Application.VBE.ActiveVBProject.References.AddFromFile "c:\Program Files\MyProject.xla"
End Sub
|