1. Open the Excel file for password cracking;
2. Click the tool --- macro on the menu bar to record the new macro and enter the macro name, for example, AA;
3. Stop recording (in this way, an empty macro is obtained );
4. Click the tool --- macro-macro on the menu bar, select AA, and click the edit button;
5. Delete All characters (only a few characters) in the window and replace them with the following content;
Copy from the horizontal line
Bytes ------------------------------------------------------------------------------------------
Option explicit
Public sub allinternalpasswords ()
'Breaks worksheet and workbook structure passwords. Bob McCormick
'Bably originator of base code algorithm modified for coverage
'Of workbook structure/Windows passwords and for multiple passwords
'
'Norman Harker and je mcgimpsey 27-dec-2002 (Version 1.1)
'Modified 2003-apr-04 by JEM: All msgs to constants, and
'Eliminate one exit sub (version 1.1.1)
'Reveals hashed passwords not original passwords
Const dblspace as string = vbnewline & vbnewline
Const authors as string = dblspace & vbnewline &_
"Adapted from Bob McCormick base code "&_
"Norman Harker and je mcgimpsey"
Const header as string = "allinternalpasswords user message"
Const version as string = dblspace & "version 1.1.1 2003-apr-04"
Const repback as string = dblspace & "Please report failure "&_
"To the Microsoft. Public. Excel. Programming newsgroup ."
Const allclear as string = dblspace & "the workbook shocould "&_
"Now be free of all password protection, so make sure you :"&_
Dblspace & "Save it now! "& Dblspace &" and also "&_
Dblspace & "backup !, Backup !!, Backup !!! "&_
Dblspace & "also, remember that the password was "&_
"Put there for a reason. Don't stuff up crucial formulas "&_
"Or data." & dblspace & "Access and Use of some data "&_
"May be an offense. If in doubt, don't ."
Const msgnopwords1 as string = "there were no passwords on "&_
"Sheets, or workbook structure or windows." & authors & version
Const msgnopwords2 as string = "there was no protection "&_
"Workbook structure or windows." & dblspace &_
"Proceeding to unprotect sheets." & authors & version
Const msgtaketime as string = "after pressing OK button this "&_
"Will take some time." & dblspace & "amount of time "&_
"Depends on how many different passwords, "&_
"Passwords, and your computer's specification." & dblspace &_
"Just be patient! Make me a coffee! "& Authors & version
Const msgpwordfound1 as string = "You had a worksheet "&_
"Structure or Windows password set." & dblspace &_
"The Password Found was:" & dblspace & "$" & dblspace &_
"Note it down for potential future use in other workbooks "&_
"The same person who set this password." & dblspace &_
"Now to check and clear other passwords." & authors & version
Const msgpwordfound2 as string = "You had a worksheet "&_
"Password set." & dblspace & "the Password Found was :"&_
Dblspace & "$" & dblspace & "note it down for potential "&_
"Future use in other workbooks by same person who "&_
"Set this password." & dblspace & "now to check and clear "&_
"Other passwords." & authors & version
Const msgonlyone as string = "only structure/Windows "&_
"Protected with the password that was just found ."&_
Allclear & authors & version & repback
Dim W1 as worksheet, W2 as Worksheet
Dim I as integer, J as integer, K as integer, l as integer
Dim M as integer, N as integer, i1 as integer, I2 as integer
Dim I3 as integer, I4 as integer, I5 as integer, I6 as integer
Dim pword1 as string
Dim shtag as Boolean, wintag as Boolean
Application. screenupdating = false
With activeworkbook
Wintag =. protectstructure or. protectwindows
End
Shtag = false
For each W1 in worksheets
Shtag = shtag or w1.protectcontents
Next W1
If not shtag and not wintag then
Msgbox msgnopwords1, vbinformation, Header
Exit sub
End if
Msgbox msgtaketime, vbinformation, Header
If not wintag then
Msgbox msgnopwords2, vbinformation, Header
Else
On Error resume next
Do 'dummy do loop
For I = 65 to 66: For J = 65 to 66: For k = 65 to 66
For l = 65 to 66: For M = 65 to 66: For I1 = 65 to 66
For I2 = 65 to 66: For I3 = 65 to 66: For I4 = 65 to 66
For I5 = 65 to 66: for I6 = 65 to 66: for n = 32 to 126.
With activeworkbook
. Unprotect CHR (I) & CHR (j) & CHR (k )&_
CHR (l) & CHR (m) & CHR (I1) & CHR (I2 )&_
CHR (I3) & CHR (I4) & CHR (I5) & CHR (I6) & CHR (N)
If. protectstructure = false and _
. Protectwindows = false then
Pword1 = CHR (I) & CHR (j) & CHR (k) & CHR (l )&_
CHR (m) & CHR (I1) & CHR (I2) & CHR (I3 )&_
CHR (I4) & CHR (I5) & CHR (I6) & CHR (N)
Msgbox application. substitute (msgpwordfound1 ,_
"$", Pword1), vbinformation, Header
Exit do 'Bypass all for... nexts
End if
End
Next: Next
Next: Next
Loop until true
On Error goto 0
End if
If wintag and not shtag then
Msgbox msgonlyone, vbinformation, Header
Exit sub
End if
On Error resume next
For each W1 in worksheets
'Attempt clearance with pword1
W1.unprotect pword1
Next W1
On Error goto 0
Shtag = false
For each W1 in worksheets
'Checks for all clear shtag triggered to 1 if not.
Shtag = shtag or w1.protectcontents
Next W1
If shtag then
For each W1 in worksheets
With W1
If. protectcontents then
On Error resume next
Do 'dummy do loop
For I = 65 to 66: For J = 65 to 66: For k = 65 to 66
For l = 65 to 66: For M = 65 to 66: For I1 = 65 to 66
For I2 = 65 to 66: For I3 = 65 to 66: For I4 = 65 to 66
For I5 = 65 to 66: for I6 = 65 to 66: for n = 32 to 126.
. Unprotect CHR (I) & CHR (j) & CHR (k )&_
CHR (l) & CHR (m) & CHR (I1) & CHR (I2) & CHR (I3 )&_
CHR (I4) & CHR (I5) & CHR (I6) & CHR (N)
If not. protectcontents then
Pword1 = CHR (I) & CHR (j) & CHR (k) & CHR (l )&_
CHR (m) & CHR (I1) & CHR (I2) & CHR (I3 )&_
CHR (I4) & CHR (I5) & CHR (I6) & CHR (N)
Msgbox application. substitute (msgpwordfound2 ,_
"$", Pword1), vbinformation, Header
'Leverage finding pword by trying on other sheets
For each W2 in worksheets
W2.unprotect pword1
Next W2
Exit do 'Bypass all for... nexts
End if
Next: Next
Next: Next
Loop until true
On Error goto 0
End if
End
Next W1
End if
Msgbox allclear & authors & version & repback, vbinformation, Header
End sub
Bytes -----------------------------------------------------------------------------------------
Copy to above horizontal line
6. Close the editing window;
7. Click the tool --- macro ----- macro on the menu bar, select allinternalpasswords, and run the command twice;
Wait a moment, the following dialog box will appear: this is the original password corresponding to the Excel password (this password and the original password can open this document. If it is someone else's document and you want to restore the password settings, you can use this password for protection, and he can use the password he set to open it, you can try it, very interesting. Uppercase letters are required ):
Open the Excel file for password cracking