You could run a function against your original string. The function would reject anything that isn't in A-Z,a-z or 0-9
Here's a function to do that
Code:
Function fExtractStr(ByVal strInString As String) As String
' From Dev Ashish
'(Q) How do I extract only characters from a string which has both numeric and alphanumeric characters?
'(A) Use the following function. Note that the If loop can be modified to extract either both Lower and Upper case character or either
'Lower or Upper case characters or other combinations.
'************ Code Start **********
Dim lngLen As Long, strOut As String
Dim i As Long, strTmp As String
lngLen = Len(strInString)
strOut = ""
For i = 1 To lngLen
strTmp = Left$(strInString, 1)
strInString = Right$(strInString, lngLen - i)
'The next statement will extract Digits (0-9) and BOTH Lower and Upper case chars
If (Asc(strTmp) >= 65 And Asc(strTmp) <= 90) Or _
(Asc(strTmp) >= 48 And Asc(strTmp) <= 57) Or _
(Asc(strTmp) >= 97 And Asc(strTmp) <= 122) Then
'to extract just lower case, use the limit 97 - 122
'to extract just upper case, use the limit 65 - 90
strOut = strOut & strTmp
End If
Next i
fExtractStr = strOut
End Function
Sample usage:
?fExtractStr("12ws$%&^()fGbHTn_p8")
12wsfGbHTnp8
Good luck.