title: Excel spreadsheet password cracking using VBA
body: <p>I tried writing a <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> password cracker code similar to the code I used to crack Excel sheet's password But I am not sure if I am doing correctly or not - when i tried this code it prompted me for password but no password was entered to the text input box.</p>
  
  <p>Please suggest what I am doing wrong.</p>
  
  <p>Thanks </p>
  
  <pre><code>Sub testmacro()
  Dim password
  Dim a, b, c, d, e, f, g, h, i, j, k, l
  SendKeys "^r"
  SendKeys "{PGUP}"
  
  For a = 65 To 66
      For b = 65 To 66
          For c = 65 To 66
              For d = 65 To 66
                  For e = 65 To 66
                      For f = 65 To 66
                          For g = 65 To 66
                              For h = 65 To 66
                                  For i = 65 To 66
                                      For j = 0 To 255
                                          password = Chr(a) &amp; Chr(b) &amp; Chr(c) &amp; Chr(d) &amp; Chr(e) &amp; Chr(f) &amp; Chr(g) &amp; Chr(h) &amp; Chr(i) &amp; Chr(j)
                                          SendKeys "{Enter}", True
                                          MsgBox password
                                          SendKeys password, True
                                          SendKeys "{Enter}", True
  
                                          On Error GoTo 200
                                          MsgBox password
                                          GoTo 300
  200                                         password = ""
  
                                      Next
                                  Next
                              Next
                          Next
                      Next
                  Next
              Next
          Next
      Next
  Next
  300 MsgBox "exited"
  End Sub
  </code></pre>