+ Reply to Thread
Results 1 to 4 of 4

TextBox Color Change

  1. #1
    Registered User
    Join Date
    10-11-2004
    Posts
    18

    TextBox Color Change

    Hi All,

    I want to make my TextBoxes a little more fancy.

    What code is best to use when I move my mouse over the TextBox - it changes color - and when the mouse moves off it changes back to the original color?

    I have tried the Class Module, but I somehow can't figure it out.

    Hope you got the anwser

    Lenny

  2. #2
    Roman
    Guest

    Re: TextBox Color Change

    Hi Lenny,
    I hope you are talking about Userform textboxes. Then you can use this
    in the Form code:

    Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As
    Integer, ByVal X As Single, ByVal Y As Single)
    If UserForm1.TextBox1.Tag =3D 0 Then
    UserForm1.TextBox1.BackColor =3D &H80FF& 'the changed color
    UserForm1.TextBox1.Tag =3D 1
    End If

    End Sub
    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
    Integer, ByVal X As Single, ByVal Y As Single)
    If UserForm1.TextBox1.Tag =3D 1 Then
    UserForm1.TextBox1.BackColor =3D &HFFFFFF 'the regular color
    UserForm1.TextBox1.Tag =3D 0
    End If
    End Sub

    If you want to change color of the Textbox from Drawing Toolbar then I
    can=B4t help you.


  3. #3
    Roman
    Guest

    Re: TextBox Color Change

    Hi Lenny,
    I forgot one thing:
    set the textbox tag to 0 before you run the code.


  4. #4
    Registered User
    Join Date
    10-11-2004
    Posts
    18
    Hi Roman,

    Thanks for your help

    Lenny

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1