Hello. I would like to create GotFocus and LostFocus events in a class module to apply to all ComboBoxes on a certain worksheet. If I use MSForms.ComboBox I do not have access to the GotFocus and LostFocus events. If I use OLEObject I have access to only the GotFocus and LostFocus events. The ComboBoxes have already been added to another class (that may be incorrect terminology) using this code:
Option Explicit
Dim ComboBoxes() As New ITEM_COMBOBOXES
Sub InitializeBoxClass()
Dim Obj As OLEObject
Dim ComboBox_Count As Integer
For Each Obj In RPRD_PO_CREATION_WS.OLEObjects
If TypeName(Obj.Object) = "ComboBox" Then
ComboBox_Count = ComboBox_Count + 1
ReDim Preserve ComboBoxes(1 To ComboBox_Count)
Set ComboBoxes(ComboBox_Count).ITEM_COMBOBOXES = Obj.Object
Obj.ListFillRange = "ITEM_LIST"
End If
Next Obj
End Sub
Is it possible for me to use the same type of setup for the OLEObject class as well? I am having trouble after much experimentation.
Basically I need all the ComboBoxes on the worksheet to share the same KeyDown, GotFocus, and LostFocus code. What is the best way to achieve that?
Thank you.
Bookmarks