给你个小程序:
Private Sub Command1_Click()
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii < 65 Or KeyAscii > 90) And KeyAscii <> 8 And KeyAscii <> 13 Then KeyAscii = 0
If Len(Text1.Text) > 11 And KeyAscii <> 8 And KeyAscii <> 13 Then KeyAscii = 0
If (KeyAscii > 64 And KeyAscii < 91) Then Print ChrW(KeyAscii);
If KeyAscii = 13 Then
Print
Dim a(12) As String, b(12, 1) As String, str As String, c As Integer, i As Integer, m As Integer, n As Integer
str = Text1.Text
m = 0
n = 0
Do While Len(str) > 0
b(m, n) = Left(str, 1)
b(m, n + 1) = (Len(str) - Len(Replace(str, Left(str, 1), ""))) / Len(Left(str, 1))
str = Replace(str, Left(str, 1), "")
m = m + 1
Loop
For i = 0 To UBound(b) / 2 - 1
Print b(i, 0); b(i, 1)
Next
End If
End Sub