This VBA code below can be used to loop through all controls on a form, but how do I set any of the control's properties using the Control Name c.name?
Dim c As Control
For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
MsgBox "Control Name= " & c.name & " Control Value = " & c.Value
'I'm looking for this Part: c.name .BackColor = 255
End If
Next
Eh, just set the property?
Dim c As Control
For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
c.BackColor = 255
End If
Next
Intellisense won't work since you're using the general Control
and not the specific TextBox
interface, but it'll run just fine.