I'm working on a function that allows a user to pick custom colors, and that the colors they chose will be implemented on all different forms, reports, etc
For now I'm just focussing on the UserForms.
I have managed to let the user pick a background color for header and one for the detail section by using a colorpicker and storing the info in a table.
Now the harder part (?): changing the textcolor of the controls (labels, textboxes, buttons and the likes). I want to be able to use different colors in the different section of the form. I.e. all labels in the header section having white text, while all labels in detail will have darkgrey text)
I have managed this idea once (on buttons) by using tags. But I am wondering: is there an easier way to adress all controlstypes that are in a certain section only? (i.e. 'all buttons in header' or 'all textboxes in detail')
Code I used when working with tags:
Me.Painting = False
Dim MyControl As Control
Dim MyButton As CommandButton
For Each MyControl In Me.Controls
If MyControl.Tag = 99 Then
Set MyButton = MyControl
MyButton.Enabled = False
MyButton.BackColor = RGB(236, 236, 236)
Set MyButton = Nothing
End If
Next MyControl
Me.Painting = True
For now I'm just focussing on the UserForms.
I have managed to let the user pick a background color for header and one for the detail section by using a colorpicker and storing the info in a table.
Now the harder part (?): changing the textcolor of the controls (labels, textboxes, buttons and the likes). I want to be able to use different colors in the different section of the form. I.e. all labels in the header section having white text, while all labels in detail will have darkgrey text)
I have managed this idea once (on buttons) by using tags. But I am wondering: is there an easier way to adress all controlstypes that are in a certain section only? (i.e. 'all buttons in header' or 'all textboxes in detail')
Code I used when working with tags:
Me.Painting = False
Dim MyControl As Control
Dim MyButton As CommandButton
For Each MyControl In Me.Controls
If MyControl.Tag = 99 Then
Set MyButton = MyControl
MyButton.Enabled = False
MyButton.BackColor = RGB(236, 236, 236)
Set MyButton = Nothing
End If
Next MyControl
Me.Painting = True