Validate user inputted name.

D

DocBrown

I can't find an answer to this.

Any ideas how I can validate the user input from an inputbox to insure that
the name entered is a valid name, ie Name only contaings letters, numbers,
periods, and underscore, and begins with a letter, and is not a cell
reference type string.

I'm hoping I don't have to re-invent this vaildation routine and can use
something built in.

Thanks,
John
 
P

Patrick Molloy

check each character ?

return = inputbox()
bok =True
for index = 1 to len(return)
select case mid(return,1,1)
case in "abcdefghijklmnopqrstuv {and so on}"
case else
msgbox mid(return,1,1) & " is not allowed"
bOk =False
end select
if not bok then exit for
next
if bok then
msgbox "value ok"
else
msgbox "try again"
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top