How to un-protect Microsoft Excel worksheet without password

Today one of my co-workers in Finance department asked me to take a look at an Excel worksheet. He needed to add something in but all modification options like Insert, Delete were grayed out. He mentioned he was not the original guy did this worksheet and the guy who did this worksheet had left.

After I got his file and navigated around, I found that all worksheets for this file have been password protected. Since the Finance Dept. could not get the password from the original creator, he has to ask me as an “IT geek” for the help.

As you can tell, I have no idea about Excel protection at that moment. But anyway, I used Google again. Surprisely, the first search result resolved this problem.

According to the website mcgimpsey.com, the only thing you need to do is to run a VBA Macro which can reserve out the “password”. The Macro code is attached as the following.

Of course, you can download the workbook allinternalpasswords.xls if you don’t want to cut and paste the macro below. The workbook is hidden, and has an attached toolbar with a button to start the macro. Activate the workbook you want to unlock and click the button. The code is unlocked so you may examine and modify it as needed.

Remember: if you are going to open the allinternalpasswords.xls in your Excel application, you will have to downgrade your Security level first.

 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 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 to " & _

                "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, 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 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, _

                        "$$", 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 = 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: 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

156 thoughts on “How to un-protect Microsoft Excel worksheet without password

  1. Pingback: 怎样打开忘记密码的被保护的 Excel 表单 | 【超凡博俗 之 数码人生】

  2. sumeshkri

    i have used the allinternalpssword.xls. it added a addon to my excel programme. it has a pop up which gives options for remove password.i want to remove the addon from my excel programme. can i do that . or i need to reinstall the programme? thanks. have a nice day.

    [Reply]

    maxjf replied on August 6th, 2010:

    hello, I have used the add-in and don’t happens nothing. Don’t remove the restriccions in my excel file. I think that only work to remove passwords and not protection inside the file.

    Please is correct that?

    [Reply]

    Reply
  3. antoniosanct

    Thanks for this useful macro, it solved the problem, and also thanks to the original author.

    [Reply]

    Marco replied on March 18th, 2009:

    I am always suspicious of downloading stuff. However, I was pleased that this worked and didn’t have anything malicious attached to it. For office 2007 users, at the top of your screen click “Add-ins” and then you will see a “remove password” option.

    Works like a charm, and tells you what the actual password was that was previously used.

    [Reply]

    Reply
  4. Anne

    Thanks so much. You saved me hours of retyping. Loved the comment about making you a coffee while waiting for the password …. if I could have, I would have. Thanks again.

    [Reply]

    Srikanth replied on May 26th, 2009:

    Hi,
    thank you very much for your program ..
    But am not able to use this problem with .Net code and office interop.. please let guide for this solution

    [Reply]

    Reply
  5. B&GC

    THANK YOU!!! Saved me a TON of time!!! Couldn’t imagine life now without the internet and helpful people who don’t mind sharing thier “tips” for FREE! :0)

    [Reply]

    Reply
  6. stephen adams

    I have run the program and get error 91 on runing the macro.
    pasting the code in I get compile syntax error on this line
    “Const AUTHORS As String = DBLSPACE & vbNewLine & _”
    I am using excel 2003 with SP3

    [Reply]

    Reply
  7. Mauricio

    Hi, the macro works great and the sheet gets unprotected. But even if I save an unprotected version of it, when I open it is protected again with the same password… This means I have to run the macro every time I want to use the file.
    Please some help!

    [Reply]

    超凡不脱俗 replied on October 30th, 2009:

    @Mauricio, why you need to run the macro every time? you already knew the password the first ran the macro, right?

    [Reply]

    Reply
  8. Mauricio

    Thank you, maybe I didn’t explain myself well. I mean, is there a way to fully remove the password, and not having to re-enter it each time I want to open the file?
    Thanks for your help.

    [Reply]

    WebGuru replied on November 2nd, 2009:

    @Mauricio, yes, there is a way to clear the password. Since I have upgraded to Office 2007, I hope the way I describes here is the same in 2003. In Excel 2007, from Review tab then Click Protect Sheet, and clear the check box. Good luck.

    [Reply]

    Reply
  9. Rmvvvz

    First day on my new job and was asked by the CEO to unprotect a 15pg workbook with 2 yrs of financial data. The tool worked great and I’m off to a great start. Trust the code!!!

    [Reply]

    Reply
  10. kevin

    I am running 2007 version, and the workbook is protected by password and when I click the add in’s button and click remove password the message comes up saying the work book isn’t protected by a password? But it is! Any Help pls.

    [Reply]

    Reply
  11. Rev

    Nice marco, worked well for me.

    Question now is, how do you remove/disable it once you have used it? I do not see it showing listed in the AddIns area to remove/disable them.

    [Reply]

    Reply
  12. erika

    Can somebody please help me how to go about it step by step? I really really need it badly for work!! I put in a wrong password

    [Reply]

    Reply
  13. Kumar

    To erika/ jow,
    1) Just download the file and open it – enable the macros if prompted.
    2)this will add a tool bar/button – Remove passwords
    3) now open your workbook which has to be unprotected
    4) click Remove passwords button to unprotect

    hope it helps…

    [Reply]

    Reply
  14. April

    I have a mac and was a little concerned that the unique version of Excel that I have would make the marco ineffective. Thank you so much, I am a novice with excel and this helped a great deal.

    [Reply]

    Reply
  15. Grateful

    Works like a charm! Thank you for you have saved me a lot of time. I´m using Excel 2007, and instead of disabling the password from the addins button, I just selected the allinternalpasswords macro in the macro section, with the same results. Got a pop-up with the pass, I disabled the protection, and went to town with the file 🙂 Thank you again.

    [Reply]

    Reply
  16. Philip

    Fantastic – solved my problem! ps. to all those password-protectors… “get the F******G thing right before protecting it!!”

    [Reply]

    Reply
  17. Greatful-admin

    Thank you so much for this vb macro it worked like a charm with no virus or any harmful effects to my system so its not a fake post thank you to everyone helped make this happen.

    [Reply]

    Reply
  18. Mark VM

    Unbelievable! It works like a charm. I’ve thouroughly been searching the internet and after after 5 hours finally came across this page. Well done and thanks to developer!

    [Reply]

    Reply
  19. ArabBoy

    I couldn’t believe that you cracked the original password! I thought Excel’s “Password Protection” is about real “Protection” 😉

    You are Genious, Period.

    [Reply]

    Reply
  20. Dino

    I must me an idiot. I thought this may be useful so I created an excel file and added a simple password. When I run the script I get

    “There are no passwords on sheet, or workbook structure or windows.

    Adapted from Bob Cormick base code by Norman Hacker and JE McGimpsey Version 1.1.1 2003-Apr-04”

    [Reply]

    Reply
  21. Tomas

    AWESOME!
    It works! Even in MS Excel 2007! No attached virus!
    What do you need to run the script?
    1) Open MS Excel downgrade your security settings
    2) Close MS Excel
    3) download allinternalpasswords.xls
    4) Open the file that you want to unlock
    5) Enter in the visual basic editor
    6) Copy all the lines from the allinternalpasswords.xls script
    7) With the VB, insert a module on the blocked file
    8) Paste the script
    9) Press play on VB!
    There you go 😀 On my computer 4 years old computer took 5 minutes to unlock!

    [Reply]

    Preety Bareria replied on April 13th, 2011:

    Hi,

    Have tried all the methods to use this allinternalpasswords.xls file but keep getting an error while running the Macro –

    Run-time error ’91’:
    Object variable or With block variable not set

    When I DEBUG it, gives the error in following line –
    WinTag = .ProtectStructure Or .ProtectWindows

    Pls suggest. It is an important file for me for which I have forgotten the password.

    [Reply]

    Emran replied on June 20th, 2011:

    @Preety Bareria,

    I too am experiencing this problem, please help – urgent!!

    [Reply]

    Reply
  22. Idem

    Awesome worked brilliantly, followed instructions by Thomas and took me a whole 20seconds to not only unlock the password but it also told me what the password was.
    Awesome Script.

    [Reply]

    Reply
  23. Tanya

    Thank you so much, two days work on formulas has not been lost,it works really well.
    Thank you so much, a life saver

    [Reply]

    Reply
  24. Annie

    Just wanted to say thank you! my Google search returned your post but not the original so I wouldn’t have found this if it weren’t for you. It worked and saved me having to recreate a file. Thanks so much!

    [Reply]

    Reply
  25. abhijit

    Hi,

    Have tried all the methods to use this allinternalpasswords.xls file but keep getting an error while running the Macro –

    Run-time error ’91′:
    Object variable or With block variable not set

    When I DEBUG it, gives the error in following line –
    WinTag = .ProtectStructure Or .ProtectWindows

    Pls suggest. It is an important file for me for which I have forgotten the password.
    what i do please reply

    [Reply]

    Reply
  26. Lora

    Beautiful Man, Absolutely Beautiful!

    [Reply]

    Emran replied on June 20th, 2011:

    @Lora,

    How did you unlock the password protected file?
    I cannot seem to get it to work. Please talk me through the steps you took if that is ok! Help will be very much appreciated!

    [Reply]

    Reply
  27. Taporaj

    I’m afraid to say that when the worksheet is locked for modifying, it works properly…but when the complete workbook is locked, then how would it work?..coz only “Book 1” exel is protected window is displayed with password window…no other option works…so how to insert the vb script in that copy protected workbook? any reply would be obliged.

    [Reply]

    Reply
  28. Andy

    It worked great but how do I completely remove the “remove passwords” button from excel? I need to protect the document again.

    [Reply]

    Reply
  29. Stewie

    Woaaah outstanding!

    [Reply]

    karthikeyan replied on September 21st, 2011:

    hello any one helo i work in excel 2007 i put password for open a excel file, but i forget how to open, these thing can be use full to unlock worksheet, but i am unable to protect to even open my excel file can any one able to help me….
    kuttymannai@gmail.com my id help me
    important file…….

    [Reply]

    Eric replied on June 7th, 2012:

    Good and intelligent man
    there’s need to buy bear for u

    once agian thanks

    [Reply]

    Reply
  30. Yusuf

    Marvelous JOB!!
    It saved me retyping of almost 2 days work.
    My sincere thanks to you.
    Keep doing well like this.
    God bless you!

    [Reply]

    Reply
  31. Pattie

    Thanks a bunch! The author of the file had that file so locked up, you couldn’t even add the info in the cell it belonged in.

    [Reply]

    Reply
  32. karthikeyan

    hello any one helo i work in excel 2007 i put password for open a excel file, but i forget how to open, these thing can be use full to unlock worksheet, but i am unable to protect to even open my excel file can any one able to help me….

    important file…….

    [Reply]

    Reply
  33. Nad

    could u pls let me know how to use it ????
    i am quite new to macros n i hv a file to unlock could u pls help me on this by mail.
    tx n Godbless

    [Reply]

    Reply
  34. David Crompton

    Very many thanks for this. Have sent you $10 which is a fraction of what it is worth. Make sure it goes on beer.

    David

    [Reply]

    WebGuru replied on February 27th, 2012:

    @David Crompton,THANK YOU VERY MUCH! I appreciate your generous donation and having fun with friends now with your beers. Cheers!

    [Reply]

    Reply
  35. JW

    Thanks, before finding your site I’ve checked several tools but my virusscanner altered me not to download anything there. Your tool recovered the password within minutes!!
    JW

    [Reply]

    Reply
  36. abi

    hey

    im new to macros and could not able to open this

    pls tell what should i do as soon as i download the excel from allinternalpasswords.xls

    [Reply]

    Reply
  37. Nandakumar K B

    hi!
    I’m unable to open my worksheet, since i forgot my password and also i can’t download any software bcoz in my there not suppose to download or browse. Pls help me..

    [Reply]

    Reply
  38. Ana T.

    I was totally hesitant when I read this because I kept thinking it couldn’t possibly be this simple. I was wrong because it worked! Thanks a million!!

    [Reply]

    Reply
  39. Sandya

    Hi,
    Can some one help me how to use the code…
    kindly help me out pls

    [Reply]

    Sandya replied on April 20th, 2012:

    @Sandya, I cleared my password thanks alot

    [Reply]

    Reply
  40. nobody

    Nice, clean, and efficient code. One suggestion though:
    Add “Application.ScreenUpdating = True” to the two positions in the code right before you find “Exit Sub”. Otherwise you might end up with the screen “frozen”.

    [Reply]

    Reply
  41. J Johnson

    Thank you Jesus and Praise the LOAD.

    Thank u thank u and thank u.
    After a 24hrs of strugle and searching its realy help me 1000%

    [Reply]

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Please Answer: * Time limit is exhausted. Please reload the CAPTCHA.