Sub test() Dim i As Long Dim j As Long Dim k As Long Dim l As Long i = 48 j = 48 k = 48 l = 48 Dim arr() as String Dim index as Long Dim i as Long index = 0 i = 0 Open "C:\Users\John\Desktop\dictionary.txt" For Input As #1 Do While Not EOF(1) ' Loop until end of file. index = index + 1 redim preserve arr(index) ' Redim the array for the new element Line Input #1, arr(index) ' read next line from file and add text to the array Loop Close #1 ' Close file. index = index + 1 Dim i As Long Dim j As Long Dim k As Long Dim l As Long Dim m As Long i = 97 j = 97 k = 97 l = 97 m = 97 Dim passAtmp As String passAtmp = "" Dim FileName As String FileName = "C:\Users\John\Desktop\Secret.doc" ScreenUpdating = False Line2: On Error GoTo Line1 Documents.Open FileName, , True, , passAtmp MsgBox "Password is " & passAtmp Application.ScreenUpdating = True Exit Sub Line1: i = i + 1 If i = 58 Then i = 65 End If If i = 91 Then i = 97 End If If i > 122 Then i = 48 j = j + 1 End If If j = 58 Then j = 65 End If If j = 91 Then j = 97 End If If j > 122 Then j = 48 k = k + 1 End If If k = 58 Then k = 65 End If If k = 91 Then k = 97 End If If k > 122 Then k = 48 l = l + 1 End If If l = 58 Then l = 65 End If If l = 91 Then l = 97 End If If l > 122 Then MsgBox "No password found" Exit Sub End If passAtmp = Chr(i) & Chr(j) & Chr(k) & Chr(l) passAtmp = arr(i) i = i + 1 If i = index Then MsgBox "No password found" Exit Sub End If i = i + 1 If i > 122 Then i = 97 j = j + 1 If j > 122 Then j = 97 k = k + 1 If k > 122 Then k = 97 l = l + 1 If l > 122 Then l = 97 MsgBox "No password found for " & passAtmp m = m + 1 If m > 122 Then MsgBox "No password found" Exit Sub End If End If End If End If End If passAtmp = Chr(m) & Chr(l) & Chr(k) & Chr(j) & Chr(i) Resume Line2 ScreenUpdating = True End Sub