Hi, I have some code that I used to format the controls of a form. I know want to re-use that code to format other/different User Forms
My code is:
I have replaced the above FOR loop with:
Call FormColourGreen(Me.Name)
In Module 1, I have the following code (doesn't work)
Your help will be very much appreciated Many Thanks
My code is:
Code:
Private Sub UserForm_Initialize()
Dim ctrl As Control
'Loop Through each LABEL control on UserForm->frmTxAdd
For Each ctrl In Me.Controls
If TypeName(ctrl) = "Label" Then
ctrl.BackColor = RGB(241, 248, 233)
End If
Next ctrl
End Sub
Call FormColourGreen(Me.Name)
In Module 1, I have the following code (doesn't work)
Code:
Sub FormColourGreen(FrmName)
Dim ctrl As Control
' Set background colour - very light green
'Loop Through each LABEL control on UserForm
For Each ctrl In frmName.Controls
If TypeName(ctrl) = "Label" Then
ctrl.BackColor = RGB(241, 248, 233)
End If
Next ctrl
End Sub
Last edited by a moderator: