Extract only alphabetical values from alphanumeric string/text

We can extract only alphabets from any given string by using below user defined function in access vba.
Public Function udfExtractAlphachars(strInput) As String
Dim strResult As String, strCh As String
Dim i As Integer
If Not IsNull(strInput) Then
For i = 1 To Len(strInput)
strCh = Mid(strInput, i, 1)
Select Case strCh
Case "a" To "z"
strResult = strResult & strCh
Case Else
End Select
Next i
End If
udfExtractAlphachars= strResult
End Function

No comments:

Post a Comment