The following example includes event procedures for the ItemAdded and ItemRemoved events. To try this example, first create a new class module by clicking Class Module on the Insert menu. Paste the following code into the class module and save the module as RefEvents:

The following Function procedure adds a specified reference. When a reference is added, the ItemAdded event procedure defined in the RefEvents class runs. For example, to set a reference to the calendar control, you could pass the string “C:\Windows\ System\Mscal. ocx”, if this is the correct location for the calendar control on your computer.

‘ Create new instance of RefEvents class.
Dim objRefEvents As New RefEvents

‘ Pass file name and path of type library to this procedure.
Function AddReference( strFileName As String) As Boolean
Dim ref As Reference

Featured Posts

Career Opportunity (source : http://www.starperforma.com ) PT. Star Performa is founded in 2003 with our aim to help our clients in the highest business performance. Using our expertise in management and technology consulting, we deliver business consulting, business process design, system integration, and application design and management. In our rapid growth, we are seeking talented […]