<font class="small">Code:</font><hr /><pre>Function GetRandomString(Len)
dim i, s
const startChr ="A", range = 26
s = ""
for i = 0 to len-1
s = s + Chr(asc(startChr) + Rnd() * range )
GetRandomString = s
end function </pre><hr />
There is a neat function I got from these forums. I apologize to whoever created it; I've forgotten who you are and therefore cannot offer proper credit.
The benefit of this function is you can pick a string of any length of any characters (digits, alpha, unicode, whatever).
'This function randomly picks a specified number of characters from a specified character set.
' PickString A list of single characters from which random characters will be chosen
' HowMany The number of random selections to be made from PickString
' x = RndStr("1234567890", 7) x will be assigned a 7 digit random number (as a string)
' x = RndStr("abcdefghijklmnopqrstuvwxyz", 12) x will be assigned 12 random characters from a-z
Public Function RndStr(PickString,HowMany)
For i=1To HowMany
RndStr = RndStr & Mid(PickString,Int((Rnd()*k)+1),1)