+ Reply to Thread
Results 1 to 3 of 3

Textbox accepts alpha only

  1. #1
    LeLi
    Guest

    Textbox accepts alpha only

    hello there! i have this 3 textboxes then what i want to do is to
    accept alpha only..because my textbox labeled as the name of a person.
    thanks!


  2. #2
    Patrick Molloy
    Guest

    RE: Textbox accepts alpha only

    use the textbox's key press to trap and test which key was pressed.
    The code below will allow a space, a hyphen, uppercase and lowercase letter
    only. Anything else, then keyascii is set to 0, so nothing gets added to the
    text

    Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Select Case KeyAscii
    Case 32, 45, 65 To 90, 97 To 122
    ''do nothing, these are OK
    Case Else
    ' clear the key, we don't want it
    KeyAscii = 0
    End Select
    End Sub

    "LeLi" wrote:

    > hello there! i have this 3 textboxes then what i want to do is to
    > accept alpha only..because my textbox labeled as the name of a person.
    > thanks!
    >
    >


  3. #3
    LeLi
    Guest

    Re: Textbox accepts alpha only

    thanks Patrick!


+ 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