You use a class to create an object that subscribes to the events raised by the labels, something like:
Class1:
Option Explicit
Private WithEvents p_lbl As MSForms.label
Public Property Set label(lbl As MSForms.label)
Set p_lbl = lbl
End Property
Private Sub p_lbl_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub
Userform:
Option Explicit
Dim eventHandlers As Collection
Private Sub UserForm_Initialize()
Dim h As Class1
Dim ctl As Control
Set eventHandlers = New Collection
For Each ctl In Me.Controls
If TypeOf ctl Is MSForms.label Then
Set h = New Class1
Set h.label = ctl
eventHandlers.Add h
End If
Next ctl
End Sub
Bookmarks