Excel worksheet protection password forgot, how to undo sheet protection?

Source: Internet
Author: User
Tags goto password protection

Follow the steps below,
If you don't email me [email protected]

1\ Open File
2\ TOOL---Macro----record a new macro---Enter a name such as: AA
3\ Stop recording (so get an empty macro)
4\ TOOL---Macro----macro, select AA, click Edit button
5\ Delete all the characters in the window (only a few), replace with the following: (You copy it)
Option Explicit
Public Sub allinternalpasswords ()
' Breaks worksheet and workbook structure passwords. Bob McCormick
' Probably 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 by" & _
"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 should" & _
"Now being free of any password protection, so make sure you:" & _
Dblspace & "SAVE IT now!" & Dblspace & "and also" & _
Dblspace & "backup!, backup!!, Backup!!!" & _
Dblspace & "Also, remember that the password is" & _
"Put there for a reason. Don ' t stuff up crucial formulas "& _
"or data." & Dblspace & "Access and use of some data" & _
"May is 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 is no protection to" & _
"Workbook structure or Windows." & Dblspace & _
"Proceeding to unprotect Sheets." & AUTHORS & VERSION
Const msgtaketime as String = "After pressing OK button This" & _
"would take some time." & Dblspace & "Amount of Time" & _
"Depends on how many different passwords, the" & _
"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 the future use of other workbooks by" & _
"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" and "Workbooks by Same" & _
' Set this password. ' & Dblspace & ' Now to check and clear ' & _
"Other passwords." & AUTHORS & VERSION
Const Msgonlyone as String = "Only Structure/windows" & _
"Protected with the password is 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 with
Shtag = False
For each W1 in worksheets
Shtag = Shtag Or W1. ProtectContents
Next W1
If not Shtag and is 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 = 66:for j = 66:for k = 66
For L = 66:for m = 66:for I1 = 66
For i2 = 66:for i3 = 66:for I4 = 66
For i5 = 66:for I6 = All to 66:for n = 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 with
Next:Next:Next:Next:Next:Next
Next:Next: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 = 66:for j = 66:for k = 66
For L = 66:for m = 66:for I1 = 66
For i2 = 66:for i3 = 66:for I4 = 66
For i5 = 66:for I6 = All to 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 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 in other sheets
For each W2 in worksheets
W2. Unprotect PWord1
Next W2
Exit do ' Bypass all for...nexts
End If
Next:Next:Next:Next:Next:Next
Next:Next:Next:Next:Next:Next
Loop Until True
On Error GoTo 0
End If
End with
Next W1
End If
MsgBox AllClear & AUTHORS & VERSION & Repback, vbinformation, HEADER
End Sub
6\ Close the edit window
7\ Tool---Macro-----macro, choose Allinternalpasswords, Run, determine two times, etc 2 minutes, and then OK. OK, no password!!

Excel worksheet protection password forgot, how to undo sheet protection?

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.