テキストのみ
Function Alphas(ByVal strInString As String) As String 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 BOTH Lower and Upper case chars
If (Asc(strTmp) >= 65 And Asc(strTmp) <= 90 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
Alphas = strOut
終了機能
数字のみ
Function Numerics(ByVal strInString As String) As String 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)
If (Asc(strTmp) >= 48 And Asc(strTmp) <= 57) Then
strOut = strOut & strTmp
End If
Next i
Numerics = strOut
終了機能
数字とテキストのみ
Function Alphanumerics(ByVal strInString As String) As String 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 BOTH Lower and Upper case chars
If (Asc(strTmp) >= 65 And Asc(strTmp) <= 90 Or Asc(strTmp) >= 97 And Asc(strTmp) <= 122 or Asc(strTmp) >= 48 And Asc(strTmp) <= 57) 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
Alphanumerics = strOut
終了機能
これはExcelでも使用できますが、これはAccessで使用するために私が変更したものです