Código en el userform
---------------------
Dim Lbl() As New Class1 'Al inicio de todo el código
Private Sub UserForm_Initialize()
Dim i As Long, ctrl As MSForms.Control
i = 1
For Each ctrl In Me.Controls
If TypeName(ctrl) = "Label" Then
ReDim Preserve Lbl(i)
Set Lbl(i).MultiLabel = ctrl
i = i + 1
End If
Next
End Sub
Private Sub UserForm_Initialize()
Dim i As Long, ctrl As MSForms.Control
i = 1
For Each ctrl In Me.Controls
If TypeName(ctrl) = "Label" Then
ReDim Preserve Lbl(i)
Set Lbl(i).MultiLabel = ctrl
i = i + 1
End If
Next
End Sub
------------------
Código en la clase:
--------------------------
Public WithEvents MultiLabel As MSForms.Label
Private Sub MultiLabel_Click()
With MultiLabel
If .Caption = "" Then
.Caption = "X"
Else
.Caption = ""
End If
End With
End Sub
Private Sub MultiLabel_Click()
With MultiLabel
If .Caption = "" Then
.Caption = "X"
Else
.Caption = ""
End If
End With
End Sub
------------------------
Recomendación
No hay comentarios.:
Publicar un comentario