Code
Public Function SArr_StrExists(SArray() As String, MyString As String, CaseSen As Boolean) As Boolean
'Function
'   Used to determine if a String value is contained in an array.
'Parameters
'   SArray (String()) = The array to search.
'   MyString (String) = The value to search for.
'   CaseSen (Boolean) = If True, the comparison is case-sensitive.
'       If False, the comparison is not case-sensitive.
'       In this case, if MyString is found in SArray without regard to case, function returns True.
'Return
'   Returns True if the specified value (MyString) is contained in the array.
'   Returns False if:
'       The specified value (MyString) is not contained within the array.
'       The specified array (SArray) is empty.
'Version History
'   1.0 4/1/2006 7:28am Tested by Russ Tanner on VB6 Win2000
'---

'Initiate variables
Dim i As Long 'index into SArray

'Default return value
SArr_StrExists = False

'Trap: SArray is empty, always return False
If IsEmptyArray(SArray) Then Exit Function


'Loop through all elements in the array searching for a match...

'New default return value
SArr_StrExists = True

'The search is case-sensitive
If CaseSen Then
    
    'Loop through all items in the array. If a match is found, return True and exit.
    For i = LBound(SArray) To UBound(SArray)
        If MyString = SArray(i) Then Exit Function
    Next i
    
'The search is not case-sensitive
Else
    
    'Loop through all items in the array. If a match is found, return True and exit.
    For i = LBound(SArray) To UBound(SArray)
        If UCase(MyString) = UCase(SArray(i)) Then Exit Function
    Next i

End If


'All items have been tested but no match was found, return False
SArr_StrExists = False

End Function


The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)