View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown Gary Brown is offline
external usenet poster
 
Posts: 178
Default Removing a reference from the LIST

In VBA, before referencing your add-in, delete the old reference using
something like....

Dim iIndex As Integer
Dim strMyReference As String
Dim refReference As Variant

'full path and name of C # addin
strMyReference = "C:\Client\addins\My_C_Addin.dll"

iIndex = 0
For Each refReference In _
Application.VBE.ActiveVBProject.References
iIndex = iIndex + 1
If refReference.FullPath = strMyReference Then
'remove reference
With Application.VBE.ActiveVBProject.References
.Remove .Item(iIndex)
End With
Exit For
End If
Next

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"BlueTrin" wrote:

Hello all,

I have tried to google search but I got only links explaining how to
remove a reference from a VBA project.

At the moment I am developping a C# addin, however each time I
reference it, it creates a new entry in the references list. Is it
programmatically possible in VBA or C# to check all the reference and
remove the bogus ones from the list itself ?

Cheers
Anthony