ReferencesEvents Property

Applies To

Events object.

Description

Returns the ReferencesEvents object. Read-only.

Settings

The setting for the argument you pass to the ReferencesEvents property is:

Argument

Description

vbproject

If vbproject points to Nothing, the object that is returned will supply events for the References collections of all VBProject objects in the VBProjects collection.
If vbproject points to a valid VBProject object, the object that is returned will supply events for only the References collection for that project.


Remarks

The ReferencesEvents property takes an argument and returns an event source object. The ReferencesEvents object is the source for events that are triggered when references are added or removed.

See Also

Add method, CommandBarEvents property, ReferencesEvents object, Remove method, VBProject object, VBProjects collection.

Example

The following example uses code including the ReferencesEvents property to support event-handling code for adding or removing references.

Private WithEvents X As ReferencesEvents

Sub Test()
    Set X = Application.VBE.Events.ReferencesEvents
End Sub

Private Sub X_ItemAdded(ByVal Reference As VBIDE.Reference)
    ' Put code to support item addition here
End Sub

Private Sub X_ItemRemoved(ByVal Reference As VBIDE.Reference)
    ' Put code to support item removal here
End Sub