Public Function CountDistinctLetter(ByVal strSource As Variant) As Integer
Dim strTemp As String
Dim intLen As Integer
Dim intLoop As Integer
Dim strChar As String
strSource = strSource & ""
intLen = Len(strSource)
For intLoop = 1 To intLen
strChar = Mid(strSource, intLoop, 1)
' only letter and digit
' remove this IF if you also want to test for these characters
If InStr(1, " .,;!@#$%^&*()_-:|\'<>?/\=0123456789" & """", strChar) = 0 Then
If InStr(1, strTemp, strChar) = 0 Then
'If InStr(1, stretmp, strChar, vbTextCompare) = 0 Then
strTemp = strTemp & strChar
End If
End If
Next intLoop
CountDistinctLetter = Len(strTemp)
End Function