by Megagix (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
This code will change the forecolor for Labels and Textboxes (can be edited for Other Controls).
Sub ChangeFont(frm As Form, color As String)
On Error GoTo errhand
Dim Control
For Each Control In frm.Controls
If TypeOf Control Is Label Then Control.ForeColor = color
If TypeOf Control Is TextBox Then Control.ForeColor = color
Next Control
Exit Sub
errhand:
MsgBox "Error Changing Font Color!", vbCritical
End Sub