Frage zu Label_Click Ereignis in UserForm!?!
19.05.2005 11:22:50
Oliver
ich hab da mal ein Frage. Ich erzeuge mit nachfolgendem Makro in einer UserForm 2 Labelfelder (Label 5 und 6) und formatiere die noch ein wenig. Nun habe ich in der UserForm ein Label_Click Ereignis eingetragen, welches bei Klick auf das neu erzeugte Labelfeld Label6 eine Aktion durchführen soll. Leider funktioniert das nicht. Ich gehe mal davon aus, dass es daran liegt, dass es ja eigentlich in der UserForm kein Labelfeld Label6 gibt. Weiß jemand wie ich es dennoch anstellen kann, dass bei Klick auf das neu erzeugte Feld eine Aktion ausgeführt wird.
Hier erst mal das Makro, dass die beiden Labels erzeugt
Sub Makro_x()
Dim neuLabel_1 As Control, neuLabel_2 As Control
With Info_2
.Height = 463.5
.Width = 235.5
'Position
.Left = 0
.Top = 0
End With
With Info_2.Controls("CommandButton1")
'Position
.Left = 66
.Top = 396
End With
Set neuLabel_1 = Info_2.Controls.Add("Forms.Label.1")
With Info_2.Controls("Label5")
.Height = 30:
.Width = 168
'Position
.Left = 30
.Top = 348
.Visible = True
.Caption = "Testtext"
.TextAlign = 2
End With
Info_2.Controls("Label5").Font.Name = "Arial"
Info_2.Controls("Label5").Font.Charset = 2
Set neuLabel_2 = Info_2.Controls.Add("Forms.Label.1")
With Info_2.Controls("Label6")
.Height = 12:
.Width = 168
'Position
.Left = 30
.Top = 378
.Visible = True
.Caption = "Testtext"
.ForeColor = &HFF0000
.TextAlign = 2
End With
Info_2.Controls("Label6").Font.Name = "Arial"
Info_2.Controls("Label6").Font.Charset = 2
Info_2.Controls("Label6").Font.Underline = True
End Sub
Ich hoffe, Ihr habt mich einigermaßen verstanden und hoffe, dass jemand eine Antwort, bzw. eine Lösung hat.
Danke Euch schon mal,
Oliver