Excel worksheet protection password hack macro code

Source: Internet
Author: User
Tags password protection

Under a Microsoft Soft Institute Development Group intern application form, want to fill but can't fill in.

The original he made a lock on the work table, there are passwords, I guess he did not deliberately deceptive, want to apply to Microsoft's people even this means there is no one else will not want. The following macro code is to break the work table locked.

<span style= "Font-size:12px;color: #000000;" >public SUB Worksheet protection password cracking () Const dblspace As String = vbNewLine & Vbnewlineconst AUTHORS As String = Dblspace & VbN Ewline & _ "Author: McCormick JE McGimpsey" Const HEADER As String = "Worksheet protection password cracking" Const VERSION As String = Dblspace & " Version 1.1.1 "Const repback As String = Dblspace &" "Const Zhengli As String = Dblspace &" h  fhzi3-"Const allclear as String = dblspace &" Worksheet password protection in this workbook is all unblocked! "& Dblspace &" Remember to save "_& Dblspace & "NOTE: Do not use in inappropriate places, to respect the fruits of the work of others!" "Const MSGNOPWORDS1 As String =" There is no encryption in the file worksheet "Const MSGNOPWORDS2 As String =" There is no encryption in the file sheet 2 "Const msgtaketime As String =" solution It takes a while, please be patient! "& Dblspace &" Press OK to start cracking! " Const MSGPWORDFOUND1 as String = "Password regroup:" & Dblspace & "$$" & Dblspace & _ "If the file sheet has a different password, search for the next set of passwords and modify the purge" C Onst MSGPWORDFOUND2 as String = "Password re-grouping:" & Dblspace & "$$" & Dblspace & _ "If the file sheet has a different password, the next set of passwords will be searched and released" Cons T Msgonlyone as String = "Make sure it's unique?" Dim W1 as Worksheet, W2 as Worksheetdim I As Integer, J As Integer, K As Integer, L as Integerdim m as Integer, n as Integ Er, i1 As Integer, i2 as Integerdim i3 as Integer, I4 as Integer, i5 as Integer, I6 as Integerdim PWord1 as StringDim Shta G as Boolean, wintag as booleanapplication.screenupdating = Falsewith Activeworkbookwintag =. ProtectStructure Or. Protectwindowsend Withshtag = falsefor each w1 in Worksheetsshtag = Shtag Or W1. Protectcontentsnext w1if not Shtag and not Wintag Thenmsgbox MSGNOPWORDS1, vbinformation, headerexit subend ifmsgbox MSGTA Ketime, vbinformation, Headerif not wintag thenelseon Error Resume nextdo ' dummy do loopfor i = all to 66:for j = 66 : For k = 66For L = 66:for m = N to 66:for i1 = All to 66For i2 = N to 66:for i3 = N to 66:for i4 = o 66For i5 = 126With to 66:for I6 = All to 66:for n = to 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 ThenPWord1 = 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, Headerexit do ' Bypass all For...nextsend ifend WithNext:Next:Next:Next:Next:NextNext:Next: Next:Next:Next:NextLoop Until trueon Error GoTo 0End ifif Wintag and not Shtag Thenmsgbox Msgonlyone, vbinformation, H  Eaderexit subend Ifon Error Resume nextfor each w1 in worksheets ' attempt clearance with Pword1w1.unprotect Pword1next w1On Error GoTo 0ShTag = falsefor each w1 in worksheets ' Checks for all clear shtag triggered to 1 if not. Shtag = Shtag Or W1. Protectcontentsnext w1if Shtag thenfor each w1 in Worksheetswith w1if. ProtectContents thenon Error Resume nextdo ' Dummy do loopfor i = all to 66:for j = All to 66:for K= 66For L = N to 66:for m = 66:for to I1 = 66For I2 = All to 66:for i3 = N to 66:for i4 = All to 66For i5 = 66:for I6 = 66:for n = 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 ThenPWord1 = 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, _ "$$", Pword  1), vbinformation, HEADER ' leverage finding pword by trying ' and ' sheetsfor each w2 ' Worksheetsw2.unprotect Pword1next W2exit do ' Bypass all for...nextsend IfNext:Next:Next:Next:Next:NextNext:Next:Next:Next:Next:NextLoop Until Tru EOn Error GoTo 0End ifend WithNext w1end ifmsgbox allclear & AUTHORS & VERSION & Repback & Zhengli, Vbinfo Rmation, Headerend sub</span>


Excel worksheet protection password hack macro code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.