I came up with this function while trying to validate a filename for a script. The function will take a string and a list of characters to look for and will return true if the string contains one or more of those characters. An example would be looking for \/:*?"<>| as these characters should not appear in a filename, so if they exist the filename is not valid. You would call it in the following way:
You may notice that there are two " next to each other, because strings are surrounded by " you have to use a " before a " to insert the " in the list, if not the string would close after the ? and you would receive an error.
Not for more advanced users you could also use the regexp to perform something similar.
Function checkForSpecialChar(temp_string As String, temp_list As String) As Boolean
Dim strLen As Integer
Dim tempChar As String
Dim i As Integer
Dim pos As Integer
checkForSpecialChar = FALSE
strlen = Len(temp_list)
For i = 1 To strLen
tempChar = Mid(temp_list, i, 1)
pos = InStr(1, temp_string, tempChar)
If pos > 0 Then
checkForSpecialChar = TRUE