Private Sub Command1_Click()
Dim s As String
Dim i As Integer, j As Integer, t As Integer
Dim ascS(4) As Integer
s = InputBox("请输入4个字符")
If Len(s) > 4 Then s = Mid(s, 1, 4)
For i = 1 To 4
ascS(i) = Asc(Mid(s, i, 1))
Next
For i = 1 To 3
For j = i + 1 To 4
If ascS(i) > ascS(j) Then
t = ascS(j)
ascS(j) = ascS(i)
ascS(i) = t
End If
Next
Next
s = ""
For i = 1 To 4
s = s + Chr(ascS(i))
Next
MsgBox s
End Sub