Hi,
I have a userform that I want to work in a way that focused control have a different back colour, making it obvious to the user which field they are in. I know I can apply this on a control-by-control basis, but I hate that manual stuff. It's inelegant.
I've come up with a loop structure. It's not throwing up any errors, but it's not working either. Maybe the code is in the wrong place.
Any idea would be greatly appreciated.
Art3mis9
I have a userform that I want to work in a way that focused control have a different back colour, making it obvious to the user which field they are in. I know I can apply this on a control-by-control basis, but I hate that manual stuff. It's inelegant.
I've come up with a loop structure. It's not throwing up any errors, but it's not working either. Maybe the code is in the wrong place.
Code:
Dim ctl As MSFORMS.Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
If (ctl Is ActiveControl) Then
ctl.BackColor = &H500050
End If
Case "ComboBox"
If (ctl Is ActiveControl) Then
ctl.BackColor = &H500050
End If
End Select
Next ctl
Any idea would be greatly appreciated.
Art3mis9