I am trying to create labels in a Frame during runtime with VBA. The problem is, I want to be able to click them once they are created. So this is what I made : (my labels are attached to a Frame)
Set TheLabel = Frame.Controls.Add("Forms.Label.1", Visible = True)
With TheLabel
.Name = "Label" & i
.Caption = gTab(i, 2) & "_ " & gTab(i, 0) & Temp
.Left = 6 + gTab(i, 2) * 12
.Top = 12 + 16 * i
.Height = 12
.Width = 200
End With
Where i is an integer (it's the number of the current label). With this code, I imagine the name of my Label is now Label1, Label2 etc.
But even with this piece of code:
Private Sub Label1_Click()
Frame.Height = 200
End Sub
It doesn't seem to work.
Thanks a lot!