When I run the following snippet, and enter an acceptable value, I get the desired result.
do while len(strselect) = 0 'or strselect<>"1" or strselect<>"2" or strselect<>"3"
strselect = inputbox ("Please select:" &vbcrlf&vbcrlf&_
"1. Add an entry" &vbcrlf&vbcrlf&_
"2. Remove an entry" &vbcrlf&vbcrlf&_
"3. Search for an entry" &vbcrlf, "Contact Book")
if isempty(strselect) then
wscript.quit()
elseif strselect="1" then
wscript.echo "You chose 1"
elseif strselect="2" then
wscript.echo "You chose 2"
elseif strselect="3" then
wscript.echo "You chose 3"
end if
loop
However if I try constrain the validation process further (by including the remark in the do while
conditions), and run the snippet again, I get the corresponding if
condition triggered, but the do
loop continues, instead of exiting.
I've tried using isnumeric
and cstr
on the do
loop strselect
conditions, with no joy... What am I missing to get the darn thing to exit the loop?