Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I'm creating a listbox at runtime for my user form ...
However, when I click on this newly created listbox, the control_click does not trigger.
Anyone have any idea where I'm going wrong?
Code:
public cCont as Control
Code:
Private Sub UserForm_Initialize()
Dim temp_ws As Worksheet
Set temp_ws = wb_sched.Worksheets("temp_ws")
Set cCont = Me.Controls.Add _
("Forms.Listbox.1", "lb_mrexcel")
...
With Me
With cCont
.Left = 14
.Top = 417
.Height = 76.55
.Width = 215.25
.Locked = False
.ForeColor = RGB(0, 52, 89)
.ColumnCount = 4
.ColumnWidths = "30;100;80;95"
.List = Range("missing_all").Value
.ListStyle = fmListStylePlain
.MultiSelect = fmMultiSelectSingle
End If
End With
...
End Sub
However, when I click on this newly created listbox, the control_click does not trigger.
Code:
Private Sub cContl_Click()
If Not mbEvents Then Exit Sub
mbEvents = False
Debug.Print Me.Name, "lb_mrexcel_Click() called"
With cCont
Debug.Print Me.Name, "lb_mrexcel_Click() ListIndex: " & .ListIndex & " (" & .List(.ListIndex) & ")"
agf = 1 'referred to from uf2_assess_sched
group_1.Show
End With
mbEvents = True
End Sub
Anyone have any idea where I'm going wrong?
Last edited: