Edelson

New Member
Joined
May 24, 2016
Messages
1
I need assign the Click event of a label that was created programmatically.


My code is working, but still can not assign the Click event dynamically:


Public Sub Create_Label()
Dim ctl As Control
Dim pic2 As String
pic2 = "C:\Documents\Pictures\Convert 24 bits.bmp"
Set ctl = UserForm1.Controls.Add("Forms.Label.1", "lblLabel1", True)
ctl.Caption = ""
ctl.Left = 20
ctl.Top = 30
ctl.Visible = True
ctl.Height = 72
ctl.Width = 72
ctl.Picture = LoadPicture(pic2)
'Assign click event
End Sub



Can anyone help me with this?
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Watch MrExcel Video

Forum statistics

Threads
1,118,302
Messages
5,571,432
Members
412,392
Latest member
Carterland
Top