Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Is the character illegal? If so replace it in workingName
- If IsError(Application.Match(Mid(inputName, i, 1), validchars, 0)) Then
- 'Detect whether the first character in workingName is a number.
- Dim numbers() As Variant
- numbers = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0")
- If Not IsError(Application.Match(Mid(workingName, 1, 1), numbers, 0)) Then
- If Not IsNumeric(Left(workingName,1)) Then
- Public Function ContainsAny(ByVal string_source As String, ByVal caseSensitive As Boolean, ParamArray find_strings() As Variant) As Boolean
- Dim find As String, i As Integer, found As Boolean
- For i = LBound(find_strings) To UBound(find_strings)
- find = CStr(find_strings(i))
- found = Contains(string_source, find, caseSensitive)
- If found Then Exit For
- Next
- ContainsAny = found
- End Function
- If Not ContainsAny(Mid(inputName,i,1), False, "_", _
- "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", _
- "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", _
- "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z") _
- Then
- 'character is illegal
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement