You are on page 1of 8

<< Click here to Goto HomePage

Monday, September 08, 2008

Whois Jason S
Jason S

Check out my blog at


http://jsbi.blogspot.com View my complete profile Click here to Subscribe to RSS feed

You may already know how easy it is to protect Microsoft Office Excel 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.

Get an e-mail automatically with new articles Enter your e-mail Go

Site Search

Web

This Website

My Blog Categories
technology (497) internet (342)

Search

Sub Macro1() ' ' Breaks worksheet and workbook structure passwords. Jason S ' probably originator of base code algorithm modified for coverage ' of workbook structure / windows passwords and for multiple passwords ' 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 As String = "AllInternalPasswords User Message" Const VERSION As String = DBLSPACE & "Version 1.0 8 Sep 2008" Const REPBACK As String jasonblr@gmail.com " = DBLSPACE & "Please report failure to

blogging (336) windows (296) Tips (291) microsoft (289) news (281) software (273) announcements (201) vista (160) India (149) Bangalore (139) Review (127) programming (110) personal (84) google (81) Gadgets (70) mac (56) mp3 (54) videos (50) Travel (37) Office (34) story (33) Windows 7 (32) Quotes (29) health (26) linux (26) photoshop (25) iPhone (24) yahoo (16) HP (10) Mobile (10) Contests (9) sap (9) zune (9) Portable Apps (8) Printers (8) FaceBook (7) NetBook (7) enterprise portal (6) K810i (4) Anti-Virus (3) Guest Article (3) MotherBoards (2) Windows 8 (2) abap (2) Android (1)

Cool Followers of this Site


with Google Friend Connect

Members (89) More

Already a member? Sign in

The Treasure Trove of Articles


2012 (8) 2011 (1) 2010 (22) 2009 (167) 2008 (140) December (3) November (1) October (12) September (15) How to keep your computer Clean and Fast easily? 100+ wishes on Orkut + Facebook for your Birthday!... Apple updates iTunes 8 to fix Vista's blue screen ... Google in the last 10 years - An Insight Happy Onam How to easily reset Administrator password in Wind... What programs slow your Windows PC? Apple unveils new iPod Nano and iPod Touch Scientists will re-enact the Big Bang theory today... Link to Offline Installer for a clean Google Chrom...

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 " & "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 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 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, 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 "$$", PWord1),

Asus (1)

IE8 Beta 2 : First Aid Kit :: Funny How to easily Unprotect/Remove Password from a Pro... Easy Fix for : Windows Picture and Fax Viewer does... How to fix Windows Explorer crash when viewing fol... 31 Reasons Why you Shouldn't Buy an iPhone 3G! August (16) July (5) June (7) May (10) April (20) March (23) February (16) January (12) 2007 (466) 2006 (170)

The Most Interesting Technology Articles


How to Uninstall Windows Vista easily without any hassles Consolidated Customer Care Numbers How to remove DRM legally from WMV file collection you own? Free Rapidshare Premium Link Generator The Actual Harry Potter and the Deathly Hallows Ending :: Who all will die? Free MegaUpload Premium Link Generator Harry Potter and the Deathly Hallows :: E-Book Freely available Online Now How to dual boot Windows Vista and Linux Ubuntu? How to enable DreamScene Video Wallpapers in ALL Windows Vista Versions How to easily calculate Income tax slab for financial year 2007 - 2008 in India? Complete list of Proxy Servers to access Blocked Sites easily How to easily find the Product Key (cd key) of your Windows Vista and Office 2007 What is the difference between Gmail.com and GoogleMail.com? How to easily Bypass the Windows Vista Boot/Logon Screen?

'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, 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 & AUTHORS & VERSION & REPBACK, vbInformation, HEADER ' End Sub "$$", PWord1),

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

Related Articles that you will be interested in...


microsoft, Office, technology, Tips, vista, windows A few FaceBook Login Tips

internet,

How to Reset or Refresh Trial period of Windows 8 PC without the installation media Norton 360 Version 4 The best Anti-Virus solution till date New Features in C# 4.0 How to easily convert .ppsx file to .pptx or .ppt? Microsoft Office 2010 Beta 2 Leaked (Build version 14.0.4514.1007 ) with the Keys Simple tips to get the most out of your Online Meetings How to easily open an encrypted / password protected PDF document UnPacking the HP Officejet Pro 8500 Wireless All-in-One Printer Why do you think thermal runaway reactions are dangerous on an industrial scale? Finally we have a Steam client for Mac for FREE from Valve Complete list of Best and Free Anti-Virus for your Windows 7 :: Updated on May 2010 Why should NFC be switched off when not in use? Windows 8 Activation Key Serial Available for Free Download How to easily Uninstall Internet Explorer 9 when the uninstall

program fails FaceBook Login www.Techolic.com[?] Like 95 people like this. Be the first of your friends.

Posted by Jason S at 11:42 Labels: internet, microsoft, Office, technology, Tips, vista, windows
0

Share this article

61 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 password" but i can't open the macro area. can you help me?
ON 9/27/2008 9:14 PM

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, Absolutely smashing stuff! 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

Anonymous said, How can i recover the password of the excel worksheet or excel file? 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

Anonymous said, Hei Jason, could please tell us just for curiosity what does this Macro does 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, Works really well! Thanks!


ON 5/27/2010 5:11 PM

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 never used macros before. Worked perfectly the first time. You've saved a lot of frustration. Thank you very much!!
ON 9/01/2010 11:46 AM

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

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

Knjigovodstvo said, It worked! Thank you a lot!


ON 1/26/2012 4:22 AM

Ben said, Wow, this was amazing... My friends think I'm a magician! Thanks for this!
ON 7/03/2012 9:58 PM

Raghunadha Murthy said, This comment has been removed by the author.
ON 7/18/2012 8:19 PM

Raghunadha Murthy said, Hi Jason, I have a protected macro in Excel 2007 and wanted to unlock it. As per your direction, I tried to record the macro, but after giving the name to the macro (eg:

Macro1) it is asking for password. So I could not able to record anything. Can you suggest any workaround for this? One more thing, I could not able to copy anything from you web Page, do I need to have any special permission to copy your code? Please let me know. If possible please send me the code to raghunadhamurthy@gmail.com
ON 7/18/2012 9:55 PM

Anonymous said, PEFRECT!!


ON 10/13/2012 3:01 AM

Klorvalex said, Thanks. I tried the code and found it works fine.
ON 2/05/2013 10:19 PM

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

2007 A.D. Jason S

You might also like