写了一个函数,用于判断你给定的那个条件:
Private Function Otstr(ByVal strin As String) As Boolean
Dim ub As Integer
Dim m As Integer
Dim a As Integer, b As Integer
Dim tmp As Integer
a = -1: b = -1
ub = Len(strin)
For m = 1 To ub
tmp = Val(Mid(strin, m, 1))
If a = -1 Then
a = tmp
ElseIf b = -1 And tmp <> a Then
b = tmp
ElseIf tmp <> a And tmp <> b Then
Otstr = False
Exit Function
End If
Next
Otstr = True
End Function