+ Reply to Thread
Results 1 to 2 of 2

Msgbox if Inputbox entry contains character

  1. #1
    Steph
    Guest

    Msgbox if Inputbox entry contains character

    Hello. I have an app.inputbox piece of code below. I would like prevent
    users from using an underscore ( _ ) in the input box. How can I modify the
    code below? Thank you!

    userinput = Application.InputBox("User Input")
    If userinput = False Then
    Exit Sub
    Else
    ***if userinput contains an underscore then
    msgbox ("cannot use underscores") vbokonly, then bring
    them back to the input box for re-entry
    else
    Run the rest of my code



  2. #2
    Bob Phillips
    Guest

    Re: Msgbox if Inputbox entry contains character

    Hi Steph,

    Her you are

    Do
    userinput = Application.InputBox("User Input")
    Loop Until userinput = False Or InStr(1, userinput, "_") = 0

    If userinput = False Then
    Exit Sub
    End If


    --
    HTH

    Bob Phillips

    "Steph" <[email protected]> wrote in message
    news:[email protected]...
    > Hello. I have an app.inputbox piece of code below. I would like prevent
    > users from using an underscore ( _ ) in the input box. How can I modify

    the
    > code below? Thank you!
    >
    > userinput = Application.InputBox("User Input")
    > If userinput = False Then
    > Exit Sub
    > Else
    > ***if userinput contains an underscore then
    > msgbox ("cannot use underscores") vbokonly, then bring
    > them back to the input box for re-entry
    > else
    > Run the rest of my code
    >
    >




+ 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