Pages

30 Apr 2012

Removing Special Characters

Using below codes for removing specific set of characters which also includes  *,?~@#$%^&*()_+{}[]":;'<,>

Function ValidateString(strInput As String) As String
Dim strInvalidChars As String
Dim i As Long
strInvalidChars = "*,?~@#$%^&()_+{}[]:;<>" & "'" & """"
For i = 1 To Len(strInvalidChars)
strInput = Replace$(strInput, Mid$(strInvalidChars, i, 1), "")
Next
ValidateString = strInput
End Function

No comments:

Post a Comment