Remove Method (References Collection)
Applies To
References collection.
Description
The Remove method removes a Reference object from the References collection.
Syntax
object.Remove reference
The Remove method has the following arguments.
Argument | Description |
|
object | A string expression that evaluates to the References collection. |
reference | The Reference object that represents the reference you wish to remove. |
Remarks
To determine the name of the Reference object you wish to remove, check the Project/Library box in the Object Browser. The names of all references that are currently set appear there. These names correspond to the value of the Name property of a Reference object.
See Also
Name property.
Example
The first of the following two functions adds a reference to the calendar control to the References collection. The second function removes the reference to the calendar control.
Function AddReference() As Boolean
Dim ref As Reference, strFile As String
On Error GoTo Error_AddReference
strFile = "C:\Windows\System\Mscal.ocx"
' Create reference to calendar control.
Set ref = References.AddFromFile(strFile)
AddReference = True
Exit_AddReference:
Exit Function
Error_AddReference:
MsgBox Err & ": " & Err.Description
AddReference = False
Resume Exit_AddReference
End Function
Function RemoveReference() As Boolean
Dim ref As Reference
On Error GoTo Error_RemoveReference
Set ref = References!MSACAL
' Remove calendar control reference.
References.Remove ref
RemoveReference = True
Exit_RemoveReference:
Exit Function
Error_RemoveReference:
MsgBox Err & ": " & Err.Description
RemoveReference = False
Resume Exit_RemoveReference
End Function