checking number of character in input box

  • Thread starter Thread starter Mikey May
  • Start date Start date
M

Mikey May

I am wanting to check that an input box has the correct
number of character entered.

Thought that - If inputbox1.len = 9 then
Msgbox"9 characters"
Else
Msgbox"Not 9 characters, please check"
End If

Unfortunately it doesn't seem to be as simple as that.

Cheers
 
Try this:

Dim strInput as String
strInput = InputBox("Enter some text")

While Len(strInput) <> 9
MsgBox "Not 9 characters"
strInput = InputBox("Enter some text (again)")
Wend

MsgBox "9 characters"

or some variant thereof.

/i.
 
Back
Top