- Home
·
- String Manipulation
·
- Generates a random password (numbers & characters). Number of characters is customizable.
Generates a random password (numbers & characters). Number of characters is customizable.
Generates a random password (numbers & characters). Number of characters is customizable.
Rate Generates a random password (numbers & characters). Number of characters is customizable.
(1(1 Vote))
'leave the commandbutton at its default name (command1).
Private Sub Command1_Click()
Text1.Text = RandomPass("6") 'The 6 is the number of password charicters
End Sub
Public Function RandomPass(ByVal ChaNum As Integer) As String
For ju = 0 To ChaNum
Dim rnn As Integer
Randomize
rnn = Int(Rnd * 2) 'Generate random number 0 or 1
If rnn = "0" Then
'Get random Charicter
Dim RandNum As Integer
Dim SetChar As String
redo:
Randomize
RandNum = Int(Rnd * 122) 'generate random ascii number
If RandNum > 64 And RandNum < 90 Or RandNum > 97 And RandNum < 122 Then
'if the numbers are in the relevent area's:
'MsgBox RandNum
SetChar = Chr$(RandNum)
randomchar = randomchar & SetChar
Else
GoTo redo 'otherwise do it again
End If
Else
'Get random number
randomchar = randomchar & Int(Rnd * 9)
End If
Next ju
RandomPass = randomchar
End Function
Generates a random password (numbers & characters). Number of characters is customizable. Comments
No comments yet — be the first to post one!
Post a Comment