Dear Experts
In order to make my controls to look nice, I'd like to change the border color when the user enters and exits a control.
I've created the following two subs
Code
Sub GetEnterListbox(ByRef lst As MSForms.ListBox)
lst.BorderColor = vbRed
End Sub
Sub GetExitListbox(ByRef lst As MSForms.ListBox)
lst.BorderColor = vbBlack
End Sub
And I put the code into the onEnter/onExit of the listbox.
I'd have to create subs for each type of controls.
Is there a way to create a neater sub?
For example, a sub that just takes any object and then checks for the type of object? Like:
Code
Sub ChangeColor(ByRef obj as ?????)
'check for the type of object first
Select case obj
Case listbox
obj.BorderColor = vbRed
Case textbox
obj.BorderColor = vbRed
End Select
Exit Sub
Display More
Or is there a better way to create a sub that traps the onEnter/onExit event automatically, without me having to call a sub each time?
Some userforms have two and more listboxes and textboxes.
Thanks for your help.
Maria