I have some vba code that automatically creates a few ActiveX comboboxes. In order to handle their events I fill a global Collection with CComboEvent objects (custom class that I wrote, see below), one for every combobox. The CComboEvent objects should handle the events. While cbx_Change() in the code below works as expected, cbx_GotFocus() does not fire.
I feel like I'm overseeing something, can anyone please help?
Thank you
Option Explicit
Public WithEvents Cbx As MSForms.ComboBox
Private Sub Cbx_Change()
' TODO: Filter data that is shown in ListFillRange
' For now just show that the event fires:
MsgBox Cbx.Value ' This works as expected on every key stroke
End Sub
Private Sub Cbx_GotFocus()
MsgBox "FOCUS!" ' Never shown
' Open the dropdown list
Cbx.ListFillRange = "A1:A11"
Cbx.DropDown
End Sub