+ Reply to Thread
Results 1 to 3 of 3

"Greying" a UserForm text input box

  1. #1
    den1s
    Guest

    "Greying" a UserForm text input box

    Hi,

    Hi,

    Is there a way to "grey" out a text input box in VBA Excel and thus
    prevent users from inputing text, until certain conditions are
    fulfullied?

    I am creating a UserForm and I would like to grey out the text input
    box when a CheckBox is clicked. Not sure exactly how to do it though.


  2. #2
    AA2e72E
    Guest

    RE: "Greying" a UserForm text input box

    set the enabled property to false until ready

    "den1s" wrote:

    > Hi,
    >
    > Hi,
    >
    > Is there a way to "grey" out a text input box in VBA Excel and thus
    > prevent users from inputing text, until certain conditions are
    > fulfullied?
    >
    > I am creating a UserForm and I would like to grey out the text input
    > box when a CheckBox is clicked. Not sure exactly how to do it though.
    >
    >


  3. #3
    Doug Glancy
    Guest

    Re: "Greying" a UserForm text input box

    den1s,

    Private Sub CheckBox1_Click()
    With Me.TextBox1
    .Enabled = Me.CheckBox1.Value
    End With
    End Sub

    You can also used the Locked property of the Textbox. It has 2 advantages.
    When you change the backcolor to "gray" the text stays black so it can be
    read, and the user can copy the text for pasting elsewhere. Something to
    play with at least:

    Private Sub CheckBox1_Click()
    With Me.TextBox1
    .Locked = Not Me.CheckBox1.Value
    If Not .Locked Then
    .BackColor = vbWindowBackground
    Else
    .BackColor = vbButtonFace
    End If
    End With
    End Sub

    hth,

    Doug


    "den1s" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > Hi,
    >
    > Is there a way to "grey" out a text input box in VBA Excel and thus
    > prevent users from inputing text, until certain conditions are
    > fulfullied?
    >
    > I am creating a UserForm and I would like to grey out the text input
    > box when a CheckBox is clicked. Not sure exactly how to do it though.
    >




+ 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