Following two text files contain lists of US states.
1st contains abbreviations, 2nd contains state names.
Function to check if a state abbreviation passed is a US state or not:
Function IsUSTest(stateabbr As String) As Integer
Dim slist As String ' list of all the state abbreviations
If (stateabbr="") Then
IsUSTest=0
Exit Function
End If
slist = "|AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY|"
If (InStr(1, slist, stateabbr, 5) >0 ) Then
' found, return true
IsUSTest=1
Exit Function
Else
IsUSTest=0
Exit Function
End If
End Function
previous page
|