Is there a way to set all the text on a forms colour from VBA?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • copleyuk
    New Member
    • May 2010
    • 39

    #1

    Is there a way to set all the text on a forms colour from VBA?

    I have a form which captures Environ("USERNA ME") as String, what I want to be able to do is then be able to use the username value in an if statement to change the colour of all the text in the form.

    So far I have:

    Private Sub Form_Load()
    Dim strUser As String
    strUser = Environ("USERNA ME")

    If strUser = "A" Then me.??? = 123467

    End Sub

    I can enter specific object names after the me. to set the colour for that object but this will take a LONG time for all forms fields.
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    In VB6.0, not sure about VBA, we are able to use a for each loop construct to loop through me.controls to check typeof control is textbox/label/etc. so we can change the various properties. You might be able to do the same...



    Good Luck

    Comment

    Working...