'---------------------------------------------------------------------------------------
' Procedure : GetPWDCharacters
' Author    : Patrick Wood  http://gainingaccess.net
' Date      : 8/10/2011
' Purpose   : Get Random Characters (These are also safe to use for ODBC Passwords)
' Arguments : lngCount is the number of characters you want returned
' Example   : strPassword = GetPWDCharacters(15) - Returns a string of 15 characters
'---------------------------------------------------------------------------------------
'
Function GetPWDCharacters(lngCount As Long) As String

    Dim i As Long
    Dim j As Long
    Dim arrCharacters As Variant
    Dim strCharacters As String

    'Build an array of 75 Characters including all letters and numbers
    arrCharacters = Array( _
         "o", "S", "v", "2", "y", "Z", "I", "%", "t", "x", "6", "W", "q", "_", "j", "u", _
         "8", "k", "L", ">", "m", "C", "R", "/", "P", "9", "d", "h", "^", "w", "B", "f", _
         "+", "Q", "i", "E", "&", "a", "X", "U", "=", "g", "b", "F", "$", "O", "Y", "J", _
         "3", "0", "K", "p", "~", "s", "M", "4", "H", "l", "#", "D", "G", "N", "\", "V", _
         "c", "z", "1", "5", "T", "e", "7", "n", "<", "A", "r")

    'Loop the number of times entered
    For i = 1 To lngCount
        'Get a random number to use with the array
        j = Int((74 - 1 + 1) * Rnd + 1)
        'Get a Random letter and add it to the string
        strCharacters = strCharacters & arrCharacters(j)
    Next i

    GetPWDCharacters = strCharacters

End Function