2-character limit on InputBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All........
I am using the following line to present the user with a opportunity to
input some data. I would like to accept 0, 1, or 2 characters and reject 3
or more characters for a re-do.....help please

choice1 = InputBox("Enter PlannerCode to search for:")

TIA
Vaya con Dios,
Chuck, CABGx3
 
Neither InputBox nor Application.InputBox have any kind of validation or
input mask so if you either have to validate the input after the fact or
create a form with a text box to do what you want to do. My preference would
be for the form but to each his own...
 
Ok, thanks Jim.......I'll look doing it another way.......you've saved me
from spinning my wheels trying to make this one work.

Vaya con Dios,
Chuck, CABGx3
 
Chuck,
Maybe this...

Sub WhoAreYou()
Dim choice1 As String
Dim strMsg As String
Do
choice1 = InputBox("Enter PlannerCode to search for:", "Chuck Wants to Know", strMsg)
If Len(choice1) < 3 Then Exit Do
strMsg = "One or two characters only"
Loop
If Len(choice1) = 0 Then
Exit Sub
End If
End Sub
'--
Regards,
Jim Cone


"CLR" <[email protected]>
wrote in message
Hi All........
I am using the following line to present the user with a opportunity to
input some data. I would like to accept 0, 1, or 2 characters and reject 3
or more characters for a re-do.....help please

choice1 = InputBox("Enter PlannerCode to search for:")

TIA
Vaya con Dios,
Chuck, CABGx3
 
BINGO JIM!!!!..........your code works like a champ. Sorry I didn't get back
sooner but I had a computer crash due to lightning yesterday just after you
posted and I didn't get to try it until this morning.......

Happy camper here...........thanks again

Vaya con Dios,
Chuck, CABGx3
 
Back
Top