Private Sub Command1_Click()
Val = ""
A(0) = 5
A(1) = 6
A(2) = 8
A(3) = 9
n = -1
For i = 0 To 3
For j = 0 To 3
If j <> i Then
For k = 0 To 3
If k <> i And k <> j Then
NewVal = True
If n = -1 Then
NewVal = True
Else
For m = 0 To n
If A(i) * 100 + A(j) * 10 + A(k) = B(m) Then
NewVal = False
End If
Next m
End If
If NewVal = True Then
n = n + 1
B(n) = A(i) * 100 + A(j) * 10 + A(k)
End If
End If
Next k
End If
Next j
Next i
For m = 0 To n
Val = IIf(Val = "", CStr(B(m)), Val & " " & CStr(B(m)))
Next m
Val = "共 " & (n + 1) & " 个值" & vbCrLf & Val
MsgBox Val
End Sub