提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中恢复丢失的工作表保护密码?

我们始终设置密码以防止一些重要的工作表被其他人破坏或修改。 但是如果你忘记了密码,你怎么办? 幸运的是,Excel支持一些VBA代码来恢复丢失的工作表保护密码。 你可以这样处理这个问题:

使用VBA代码在Excel中恢复丢失的工作表保护密码


使用VBA代码在Excel中恢复丢失的工作表保护密码

以下VBA代码可以帮助您快速取消工作表中的原始密码。

1。 打开之前受保护的工作表。

2。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

3。 点击 插页 > 模块,并将以下代码粘贴到 模块窗口.

VBA代码:恢复丢失的工作表保护密码

Sub PasswordRecovery()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
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
ActiveSheet.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 ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

4。 然后点击 F5 键运行此代码,并弹出一个提示框,单击 OK 关闭它,并且受保护工作表的密码将立即被取消。

备注:

1。 使用此代码,您只需一次恢复一个工作表保护密码,如果有多个受保护的工作表,则需要逐个应用此代码。
2。 上面的代码来自 http://excelzoom.com/2009/08/how-to-recover-lost-excel-passwords/.


使用Excel中的密码轻松保护多个工作表:

在此 保护工作表 实用程序 Kutools for Excel 可以帮助您使用相同的密码批量保护多个工作表。 它还提供了同时取消保护这些工作表的实用程序。 立即下载Kutools for Excel的全功能60天免费试用版!


相关文章

如何在Excel中一次保护多个工作表?

如何在Excel中一次解除多个工作表的保护?


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Chris · 2 days ago
    I have lost the password to my Excel workbook. Every time a click to open the file, a pop up box is displayed that the file is protected however the password I enter is always incorrect, then I get a message "the password you supplied is not correct. Veryfied that the caps lock key is off and made sure to use the correct capitalization. I really need to get this file opened. Please help
  • To post as a guest, your comment is unpublished.
    Ian · 28 days ago
    Works great, as long as you are using it for the right problem. If you have worksheet protection to stop people editing formulas, etc. then this is the solution. If you have a password on the workbook for privacy (i.e. can't open workbook without password) then you will need to look elsewhere.
  • To post as a guest, your comment is unpublished.
    Franny · 1 months ago
    Thank you so much! It worked. I am running Windows 10 Pro.
  • To post as a guest, your comment is unpublished.
    Steph · 1 months ago
    THANK YOU SO MUCH!
  • To post as a guest, your comment is unpublished.
    Laddy · 1 months ago
    Worked like a charm on 2016, just as expected. Much appreciated.
  • To post as a guest, your comment is unpublished.
    Paula · 1 months ago
    utilizo la macro y se ejecuta pero
    al final no me sale el aviso con la contraseña; qué puedo hacer? gracias!!
  • To post as a guest, your comment is unpublished.
    Chithra · 6 months ago
    you mentioned, open the sheet which was protected before, what dows that mean ?

    I forgot mt workbook password, and without providing the password, alt + f11 is not working, how to break the password please?
    • To post as a guest, your comment is unpublished.
      Heather · 5 months ago
      Same problem here. Running Excel 2016, but file saved was Excel 2006. I can get into "Microsoft Visual Basic for Applications window.", but on the "Insert" tab all the options (including "Module" are greyed out. Now what can I try???
  • To post as a guest, your comment is unpublished.
    Satish · 6 months ago
    thankyou ... very very usefull
  • To post as a guest, your comment is unpublished.
    teri · 7 months ago
    I get an error: Invalid outside procedure. Please help!
  • To post as a guest, your comment is unpublished.
    vittal · 7 months ago
    THANK YOU VERY MUCH FOR CODE
  • To post as a guest, your comment is unpublished.
    Laura Gonçalves · 8 months ago
    Merci beaucoup ça a très bien fonctionné ! je suis sauvée. Merci encore
  • To post as a guest, your comment is unpublished.
    Horton · 10 months ago
    did not work for 2016, just spins and then the 'not responding'. Frustrating.
    • To post as a guest, your comment is unpublished.
      Godfrey · 8 months ago
      Same thing for me: after pressing F5, no response.
  • To post as a guest, your comment is unpublished.
    Paul · 10 months ago
    Finally. Something on the Internet that actually worked! Saved me a ton of time. Thanks!
  • To post as a guest, your comment is unpublished.
    Michael ONI · 10 months ago
    It works like magic. Many thanks.
  • To post as a guest, your comment is unpublished.
    Massimiliano Sarti · 11 months ago
    Dear all..i need to unprotect Workbook structure.. Somebody can help me?
  • To post as a guest, your comment is unpublished.
    Arlene · 11 months ago
    How long does it usually take?
    • To post as a guest, your comment is unpublished.
      Jheng · 11 months ago
      after I press the F5 button, the excel file automatically do not respond
  • To post as a guest, your comment is unpublished.
    Kindness · 1 years ago
    how does it take for code to run?
  • To post as a guest, your comment is unpublished.
    shehbaz · 1 years ago
    Thanks a lot. Its work for me.
  • To post as a guest, your comment is unpublished.
    Jay · 1 years ago
    Hi I need your help desparately. I have lost the password to my excel workbook. Every time a click to open the file, a pop up box is displayed that the file is protected however the password I enter is always incorrect, then a get a message "the password you supplied is not correct. Very that the caps lock kep is off and be sure to use the correct capitalization. I really need to get this file opened. Please help
    • To post as a guest, your comment is unpublished.
      Margot · 5 months ago
      Hi, I'm having the same issue. Were you able to somehow recover the file?
  • To post as a guest, your comment is unpublished.
    MESSI · 1 years ago
    It worked. Thanks for the help
  • To post as a guest, your comment is unpublished.
    Ellesig · 1 years ago
    Thanks so much!
  • To post as a guest, your comment is unpublished.
    guest · 1 years ago
    I'm on Excel for Mac, Mac OS High Sierra. This does not work. It does not cancel the password protection. It also does not provide a working "usable" password. Password is always incorrect. Double checked the code for the usual copy-paste script bug that automatically disables End Sub. Pasted this code into a module all by itself.
    • To post as a guest, your comment is unpublished.
      nirvana · 1 years ago
      Wrong, it works for High Sierra, as I tested it 5 min. ago.
  • To post as a guest, your comment is unpublished.
    flj · 1 years ago
    this is a life saver!
  • To post as a guest, your comment is unpublished.
    Ryan west · 1 years ago
    As soon as I press F5 it goes to not responding and I have to close Excel...
    • To post as a guest, your comment is unpublished.
      Jyel · 1 years ago
      I had the same problem. Have you solved this issue?
  • To post as a guest, your comment is unpublished.
    CL · 1 years ago
    This is a life saver! THANK YOU!
  • To post as a guest, your comment is unpublished.
    Weng · 1 years ago
    Thank you for this ♥
  • To post as a guest, your comment is unpublished.
    dianna · 1 years ago
    when i open the excel password protected file, pop up box password appear. tried hold alt+f11, nothing happens. close the password box, mvb appears but could not add module as it grey out. can someone help me please. thanks
  • To post as a guest, your comment is unpublished.
    Usman · 1 years ago
    Brilliant! Done
  • To post as a guest, your comment is unpublished.
    Madhu Joseph · 1 years ago
    I could not believe it... It worked like a wizard..
  • To post as a guest, your comment is unpublished.
    emmakelly · 1 years ago
    You guys can download this remarkable Excel Password Unlocker software which smoothly recover lost excel file and unlock protection from excel file, word document file and access file. Software easily support all Excel versions upto 2016.
  • To post as a guest, your comment is unpublished.
    Tim · 1 years ago
    Hi, Insert module is greyed out!!! Any help would be appriciated
  • To post as a guest, your comment is unpublished.
    tony · 1 years ago
    sorry doesnt works on 2010 .. ı am getting madddd
  • To post as a guest, your comment is unpublished.
    Bob · 1 years ago
    Worked like a charm.
  • To post as a guest, your comment is unpublished.
    Tochi · 1 years ago
    Please everything is greyed in the MS VB application so the insert and module can't be activated in my own.
  • To post as a guest, your comment is unpublished.
    gmnguru · 1 years ago
    Awesome code! Thanks so much!
  • To post as a guest, your comment is unpublished.
    Noob · 1 years ago
    thank you!!!!!!!!!!!!!!! you saved me lol
  • To post as a guest, your comment is unpublished.
    Elaine · 1 years ago
    The instructions were so easy to follow and worked brilliantly. I had locked myself out of a worksheet for months and couldn't remember the password, thank you
  • To post as a guest, your comment is unpublished.
    ja · 1 years ago
    worked Great!
  • To post as a guest, your comment is unpublished.
    MmM · 1 years ago
    Worked liked a charm! brilliant! cant thank you enough...
  • To post as a guest, your comment is unpublished.
    MC · 1 years ago
    I copied the entire worksheet by clicking on the top left hand corner tab (triangle) and click "copy". Then Insert a new worksheet, paste what I copied in formula mode and then use format painter to retain the formatting. it worked.
  • To post as a guest, your comment is unpublished.
    Elizabeth · 2 years ago
    Thank you so much been working on this spreadsheet for 14 months, then granddaughter decided to type on my computer and added a password ... she is 3 yrs Was very easy to use!
  • To post as a guest, your comment is unpublished.
    AOlivares · 2 years ago
    Hi, I have attempted the instructions 3x and after I press F5, the system is not responding. Is there an alternate option
  • To post as a guest, your comment is unpublished.
    HARRY · 2 years ago
    WHEN F5 KEY PRESS
    THEN ASK TO FILL MACRO NAME
  • To post as a guest, your comment is unpublished.
    Mohammed · 2 years ago
    a lot of thanks, you help me.... very clearly and simple. thank you very much
  • To post as a guest, your comment is unpublished.
    Cape town · 2 years ago
    Thanks support. The world of the IOT is really changing our lives. Thank you!
  • To post as a guest, your comment is unpublished.
    Fernando · 2 years ago
    Awesome!!! Helped a lot :lol:
  • To post as a guest, your comment is unpublished.
    Ryan · 2 years ago
    Awesome! Thank you for helping!
  • To post as a guest, your comment is unpublished.
    sam · 2 years ago
    [b]Awesome. You are Genius [/b]
  • To post as a guest, your comment is unpublished.
    Gunesh · 2 years ago
    What is approx run time for this? My machine is stuck for a while 30 min now.
  • To post as a guest, your comment is unpublished.
    Taufiq · 2 years ago
    I can't thank you enough for your kind help.
    Best wishes.