Password Generator

April 18, 2008

Private Function Generate(ByVal IntNum As Integer) As String
Dim i As Integer, intChar As Integer
Dim str As String

Randomize
For i = 1 To IntNum
intChar = Int((26 + 26 + 10) * Rnd)

If intChar < 26 Then
str = str & Chr$(intChar + Asc(”A”))
ElseIf intChar < 2 * 26 Then
intChar = intChar - 26
str = str & Chr$(intChar + Asc(”a”))
Else
intChar = intChar - 26 - 26
str = str & Chr$(intChar + Asc(”O”))
End If
Next i

Generate = str

End Function

Private Sub Send_Click()
Me.txtResult.Text = Generate(Val(Me.txtJResult1.Text))

End Sub