'生成随机密码
Function getRandomPwd(pLen) ''pLen 密码长度
If (pLen="" Or isnumeric(pLen)=false) Then pLen=6 '默认为6位
Const CharLib="123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ"
Dim iLen
iLen=Len(CharLib)
Dim i,chP
Dim strTmp
strTmp=""
Randomize()
For i=1 to pLen
strTmp = strTmp & Mid(CharLib,Int((iLen-1)*Rnd+1),1)
Next
getRandomPwd=strTmp
End Function
'产生随机密码,传入随机密码的长度
function randompwd(num)
dim i,intnum,intUpper,intLower,intRand,strPartPass,genPassword,pwdlen
genpassword=""
if isNumeric(num) then
if cint(num)>1 then
pwdlen=cint(num)
else
pwdlen=7
end if
else
pwdlen=7
end if
randomize
select case intrand
case 1
strpartpass=chr(intnum)
case 2
strpartpass=chr(intUpper)
case 3
strpartpass=chr(intlower)
end select
genpassword=genpassword & strpartpass
next
randompwd=genpassword
end function
Randomize
Do While Len(rndnum)<6
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
password=rndnum