I need to check the input of an input box to see if it contains a space, <, >, or $ and if it does to junk the string and start again. I have no idea how to even start on this one?
something like...
Dim strtext,OK
strtext = ""
OK = False
While OK = False
strtext = InputBox("Enter String","Input"
If (Instr(0,strtext," ",1) = 0) Then
If (Instr(0,strtext,"<",1) = 0) Then
If (Instr(0,strtext,">",1) = 0) Then
If (Instr(0,strtext,"$",1) = 0) Then
OK = True
End If
End If
End If
End If
Wend
Here's another method using Reg Expressions
Do
inputString = InputBox("Enter String to Check"
Dim re
Set re = New RegExp
re.Global = True
re.Pattern = "[<>/$\s]"
If re.Test(inputString) Then
strCheck = True
Else
Exit Do
End If
Loop While strCheck = True
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.