S
scott
I'm using the code below to add a reference library. Is there a vba way to
remove a reference if it exists?
CODE *********
Function ReferenceFromFile(strFileName As String) As Boolean
Dim ref As Reference
On Error GoTo Error_ReferenceFromFile
Set ref = References.AddFromFile(strFileName)
ReferenceFromFile = True
Exit_ReferenceFromFile:
Exit Function
Error_ReferenceFromFile:
Select Case Err.Number
Case 32813 ' Name conflicts with existing module, project or object
library. The reference is already set!
ReferenceFromFile = True
Case Else
'MsgBox ("Error # " & str(Err.Number) & " was generated by " &
Err.Source & Chr(13) & Err.Description)
ReferenceFromFile = False
Resume Exit_ReferenceFromFile
End Select
End Function
remove a reference if it exists?
CODE *********
Function ReferenceFromFile(strFileName As String) As Boolean
Dim ref As Reference
On Error GoTo Error_ReferenceFromFile
Set ref = References.AddFromFile(strFileName)
ReferenceFromFile = True
Exit_ReferenceFromFile:
Exit Function
Error_ReferenceFromFile:
Select Case Err.Number
Case 32813 ' Name conflicts with existing module, project or object
library. The reference is already set!
ReferenceFromFile = True
Case Else
'MsgBox ("Error # " & str(Err.Number) & " was generated by " &
Err.Source & Chr(13) & Err.Description)
ReferenceFromFile = False
Resume Exit_ReferenceFromFile
End Select
End Function