this is probably going to make me sound like I'm dumb... but, is there a function that will allow me to test if a string is equal to one of the values in an array of strings?
Printable View
this is probably going to make me sound like I'm dumb... but, is there a function that will allow me to test if a string is equal to one of the values in an array of strings?
Try this:
Code:Function CheckString(sIn As String) As Boolean
MyStringArray = Array("One", "Two", "Three", "Four", "Five")
For I = 0 To UBound(MyStringArray)
If sIn Like MyStringArray(I) Then CheckString = True
Next I
End Function
Private Sub Command1_Click()
If CheckString("One") = True Then
Print "Match Found"
Else
Print "Match not found"
End If
End Sub
thanx... i was trying to do it without a for loop but I guess that won't work... I was trying to do it like "in" in an SQL statement... oh well...