You are on page 1of 14

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe...

Page 1 of 14

<< Click here to Goto HomePage


Excel Technique VBA Custom Made Programming Solutions Contact Us Now. Free Consultation!

www.exceltechnique.com/V www.spotmau.com

Admin Password Recovery Reset Windows Admin Password. Get back to your own computer now. Password Manager Web-based Password Management Software. Free Trial Download
Ads by Google
Password Excel Macro PST Password Recover

ManageEngine.com/PasswordManagerP

Excel VBA String

AD Password R

Monday, September 08, 2008

How to easily Unprotect/Remove Password from a Protected Excel Worksheet


You may already know tweets how easy it is to protect Microsoft Office Excel retweet worksheets and workbooks from unauthorized changes with the help of a password. But, what to do if you cant remember the password you used for protecting OR you downloaded an excel from the internet and would like to have a look at the formula's or the embeded information - but all that data might be inaccessible due to the password protection.

I have a very simple method by which you can easily recover the password and also un-protect the worksheet or workbook. Please note : this method will only remove the protection from the excel file and not the password used to open the excel file itself. Open the excel file which is password protected and goto Macro's (I am using Office 2007 so the menu's maybe different View >> Macros). Click on "Record Macro >> OK" and then click on "Stop Recording" from the same menu. Now goto "View Macros", you will find a Macro with a default name E.g. Macro1 - Select the macro name and click on Edit. Now a Visual Basic Editor opens up. Re-place the default code and Paste the below code.

Sub Macro1() ' ' Breaks worksheet and workbook structure passwords. Jason S

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 2 of 14

' probably originator of base code algorithm modified for Fan Page Community coverage ' of workbook structure multiple passwords / windows passwords and for

' Jason S http://jsbi.blogspot.com ' 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" & "Jason S http://jsbi.blogspot.com" Const HEADER Message" As String = "AllInternalPasswords User

Const VERSION As String = DBLSPACE & "Version 1.0 8 Sep 2008" Const REPBACK As String = DBLSPACE failure to jasonblr@gmail.com " & "Please report

Const ALLCLEAR As String = DBLSPACE & "The workbook should be cleared" Const MSGNOPWORDS1 As String = "There were no passwords on " & AUTHORS & VERSION Const MSGNOPWORDS2 As String = "There was no protection to " & "workbook structure or windows." & DBLSPACE

Const MSGTAKETIME As String = "After pressing OK button this " & "will take some time." & DBLSPACE & "Amount of time " & "depends on how many different passwords, the "

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 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 " & Share Translate Random Recent Posts "password set." & DBLSPACE & "The password found was: " &

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 3 of 14

DBLSPACE & "$$" & DBLSPACE & "Note & "future use in other workbooks "set this password." & DBLSPACE & " & "other passwords." & AUTHORS &

it down for potential " by same person who " & Community "Now to Fan Page and clear check 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 With 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
Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 4 of 14

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 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
Share MsgBox Translate MSGONLYONE, vbInformation, Random HEADER Recent Posts Fan Page Community

"$$",

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 5 of 14

Exit Sub
Fan Page Community

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)
Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 6 of 14

If Not .ProtectContents Then


Fan Page Community 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: 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 & vbInformation, HEADER ' End Sub AUTHORS & VERSION &

"$$",

REPBACK,

Finally, run the Macro(View >> Macros >> View Macros >> Run). You will get the password of the protected workbook and worksheet in Excel. I have tested the above in Microsoft Office Excel XP / 2003 / 2007
Like 41 likes. Sign Up to see what your friends like.

Share

Translate

Random

Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 7 of 14

You might also like:


Fan Page Community

How to easily Strip attachments automatically in Microsoft ...

Ten Commandments of Orkut

How to Choose your own Location of Sent Mails in Outlook?


LinkWithin

Subscribe to this feed

Jason S suggests you to read some of these Related Tech Articles too...
nCleaner :: A Powerful Freeware System Cleaner with over 90 Functionalities Windows 7 Ultimate Crack Available for Free Download How to fix the issue of copy/paste from Print Screen - the image appears in Black and White How to fix Windows Explorer Crash :: Folder containing .avi files :: Runtime Error How to easily uninstall Internet Explorer 7 and restore back to Internet Explorer 6 How to easily set the Bing Wallpaper of the Day as your Desktop Wallpaper automatically? What programs slow your Windows PC? VMLite the best alternative for running Windows XP in your Windows 7 Use Windows Vista On / Off Feature :: Much easier than the laborious Install / Uninstall Programs The new Desktop Quick Launcher - Winstep Xtreme 8.5 with new icon reflection effect has been released

Posted by JASON S at 11:42 Labels: internet, microsoft, Office, technology, Tips, vista, windows | More

55 comments:
Joeri Van de Gender said, THX, removing the protection was really easy and the code works fine.
ON 9/16/2008 5:29 PM

bluecon said, ok, i think this is a easy way to know the password then i have the password and opened it bevor, or? how can i recover the password of the excel worksheet or excel file? when i open the password protected excel file, he asks me "please enter the Translate Recent Posts password" but i can't open the macro area. Random

Share

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 8 of 14

can you help me?


Fan Page ON 9/27/2008 9:14 PM Community

nycnyc said, Perfect! Thanks. - nyc


ON 11/09/2008 7:13 PM

LuisP said, I just unprotected a sheet in Excel 2007, and it worked very well. Thanks. Luis P.
ON 11/14/2008 4:39 PM

Anonymous said, Awesome. Worked perfectly. Thanks very much.


ON 4/13/2009 8:53 PM

Tanya said, FANTASTIC! Great work


ON 5/25/2009 11:15 PM

Anonymous said, Fab thank you worked a treat I've bookmarked the page...
ON 6/05/2009 1:51 PM

JazzyD said, I ran the macro, but it's still running. How long does it usually take?
ON 6/06/2009 11:41 AM

JASON S said, it should take a few secs only. Maybe a minute or two. Cheers!! Jason
ON 6/06/2009 3:26 PM

Anonymous said,
Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Workshe... Page 9 of 14

Absolutely smashing stuff!


Fan Page Community

You're a life saver - thanks for this!


ON 6/11/2009 5:20 PM

Anonymous said, You are the bomb diggity dude! You Rock! Thank you so much for putting this type of assistance online. This has made my day today and everyday from now on...so no matter what the password may be - I'll be able to change or remove it. Thanks again, Dorothy
ON 6/12/2009 1:32 AM

Anonymous said, thank you so much!!! Worked like a charm! Brilliant! :)


ON 7/20/2009 10:19 PM

Anonymous said, Works like a charm in Excel 2000! Thanks!!!


ON 7/28/2009 12:25 AM

Aj said, Wow!! It worked in Excel 2007. You did a great job -- Thanx.
ON 8/01/2009 2:58 AM

Mindy said, wow, this was ridiculously easy. worked like a charm on my first try! THANK YOU!
ON 10/07/2009 8:12 PM

Anonymous said, Great instructions. Thank you very much!


ON 10/28/2009 3:11 PM

Anonymous said, Wow. After searching for something like this and not having much luck, I was skeptical that this would work for Excel 2007. Worked perfectly.
ON 11/14/2009 7:59 PM

Anonymous said, awesome job Jason, this is exactly what i was searching for. I dint want some programs or add-ons.
ON 11/16/2009 5:02 PM Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Works... Page 10 of 14

Anonymous said, How can i recover the password of the excel worksheet or excel file? Fan Page
Community

When I open the password protected excel file, it asks me "please enter the password" but i can't open the macro area. can you help me?
ON 11/16/2009 9:27 PM

kiran said, worked perfectly. awsome....... thanxxxxx alot


ON 11/19/2009 12:10 PM

Anonymous said, It worked nicely thanks! One thing I noticed for me it created a file in the XLSTART folder named PERSONAL.XLSB which ended up opening everytime after I ran the macro. I deleted the file from that startup folder and it seems to be resolved.
ON 11/22/2009 6:46 AM

Anonymous said, It worked very well Jason, thanks a lot.


ON 11/22/2009 4:10 PM

Anonymous said, Thanks a lot Jason. It worked very well in Excel 2007. Keep up the good work.
ON 11/22/2009 4:17 PM

Janette said, Worked for me, too. Thanks so much for sharing this!
ON 12/01/2009 12:37 AM

Anonymous said, fantastic, thank you so much for taking the time!
ON 12/18/2009 11:03 AM

Anonymous said, You just saved my ass! Thank you Thank you Thank you.
ON 1/14/2010 11:29 PM Share

Anonymous said,

Translate

Random

Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Works... Page 11 of 14

Hei Jason, could please tell us just for curiosity what does this Macro does Fan Page Community practically?
ON 1/20/2010 1:59 AM

Anonymous said, I'm also interested in understanding how does this Macro works internally, because of all the code I don't understand excatly, I'm just a beginner in programming. Thanks.
ON 1/20/2010 1:41 PM

Jason H. said, Thank you for the code!!


ON 1/22/2010 4:15 AM

Anonymous said, Bought software to do this did not work - used your code did work! Thanks, Hans
ON 2/16/2010 3:28 AM

Deepak said, This is just excellent. Thaks for the wonderful stuff!!
ON 3/02/2010 7:09 PM

Anonymous said, thank you. worked well.


ON 4/21/2010 7:04 PM

Anonymous said, hey, just wanted to post to say thankyou no other google search actually worked and had me download stuff instead of write a macro.
ON 5/17/2010 6:43 PM

Yashvant said, hey thx man,ur code works fine.


ON 5/19/2010 11:17 AM

Anonymous said,
Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Works... Page 12 of 14

Works really well! Thanks!


ON 5/27/2010 5:11 PM Fan Page Community

Anonymous said, Thanks a lot man really its great..


ON 6/01/2010 5:00 PM

Fabian said, great stuff, worked like a cham


ON 6/03/2010 8:21 AM

Anonymous said, Great; many thanks


ON 6/14/2010 7:49 PM

Anonymous said, This worked great! Thanks!


ON 7/23/2010 11:16 PM

Anonymous said, Jason, you are a gifted fellow! Worked perfectly and you have saved me re-doing my own work. Many Thanks!
ON 8/08/2010 10:29 PM

Anonymous said, You are the best!!! Thanks... Ed


ON 8/20/2010 10:32 AM

Anonymous said, You are the best!!! thanks for creating this very clever macro... Ed
ON 8/20/2010 10:33 AM

ubeauty said, Great stuff, many thanks for circulating and sharing this information
ON 8/20/2010 1:34 PM

Anonymous said, I'd forgotten my password for an Excel 2000 worksheet. Found this page through Google and decided to give it a try. Instructions were easy to follow even though I'd
Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Works... Page 13 of 14

never used macros before. Worked perfectly the first time. You've saved a lot of frustration. Thank you very much!!
Fan Page ON 9/01/2010 11:46 AM Community

prnagaraj said, Hi It is really working. Thanks for providing such a wonderfull solution
ON 9/13/2010 10:20 PM

prnagaraj said, Hi Thanks for providing such wonderfull solution


ON 9/13/2010 10:22 PM

Anonymous said, Worked a treat on some old files


ON 9/22/2010 5:06 PM

sridhar said, It worked wonderful. Thank you very much. However, I would also like to inform you that I could not unhide the first three coloumns(A,B,C) (AND UNHIDE IS NOT WORKING) in the sheet. Could you pl. help in this regard
ON 10/28/2010 9:56 PM

Anonymous said, You are a lifesaver!!! Thanks!


ON 12/02/2010 6:45 AM

Anonymous said, Nice one saved me a lot of retyping


ON 12/17/2010 10:06 PM

Sweet gal said, Thanx!! I successfully unprotected the sheet, but the password provided to me was wrong..!! Can u please provide correct coding!
ON 12/18/2010 6:44 PM

Conference said, Worked like a charm. Thanks!


ON 2/22/2011 7:47 PM Share Translate Random Recent Posts

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

Jason S: How to easily Unprotect/Remove Password from a Protected Excel Works... Page 14 of 14

Anonymous said, THX, removing the protection was really easy and the code works fine.
ON 3/07/2011 11:17 PM

shyam said, when i open the protected excel work book it is asking for a password, how should i remove the password
ON 4/22/2011 10:32 AM

shyam said, ok, i think this is a easy way to know the password then i have the password and opened it bevor, or? how can i recover the password of the excel worksheet or excel file? when i open the password protected excel file, he asks me "please enter the password" but i can't open the macro area. can you help me?
ON 4/22/2011 10:33 AM

Post a Comment Links to this post Create a Link Newer Post Subscribe to: Post Comments (Atom) Home Older Post

2007 A.D.

http://jsbi.blogspot.com/2008/09/how-to-easily-unprotectremove-password.html

06/08/2011

You might also like