数组都不让用,估计集合也危险,对照楼上的修改下,什么都不用
Private Sub Command1_Click()
Dim i As Integer, j As Integer, temp As String, s As String
temp = "abcdefghijklmnopqrstuvwxyz"
s = ""
For i = 1 To 10
Randomize
j = Int(Rnd * Len(temp) + 1)
s = s & Mid(temp, j, 1)
temp = Left(temp, j - 1) & Mid(temp, j + 1)
Next
MsgBox s, vbInformation, "ok"
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, temp As New Collection, s As String
For i = 1 To 26
temp.Add Chr(i + 96)
Next
s = ""
For i = 1 To 10
Randomize
j = Int(Rnd * temp.Count + 1)
s = s & temp(j)
temp.Remove j
Next
MsgBox s, vbInformation, "ok"
End Sub