Function randnumber()
'随机加字母大小写,加的位数不一样,2-6位
Dim temprnd, temprnd2 As String
Dim temprndnum As Long
temprnd2 = ""
temprndnum = Int((4 * Rnd) + 2) '随机数
For i = 1 To temprndnum
If Int(Rnd() * 2) = 0 Then
temprnd = Chr(Int(Rnd() * 26) + 65) '大写英文字母
Else
temprnd = Chr(Int(Rnd() * 26) + 97) '小写英文字母
End If
randnumber = randnumber + temprnd
Next i
End Function
转载于:https://www.cnblogs.com/bignine/p/10114409.html