时间:2019-09-21  来源:百度经验  作者:jiaqing100  阅读:10

有时候为了加密我们编辑的excel工作表,常常会设置工作表保护密码,可是密码经常会不小心忘记,这时候该怎么办呢。这里小编有一个很方便的方法可以使密码自动显示出来。你是否也会经常忘记密码呢?快来试一下吧。

excel工作表保护密码忘记了怎么办?

首先打开设置了工作表保护的表格,可以看到,当我们试图编辑时,会弹出这样的对话框。

excel工作表保护密码忘记了怎么办?

这时如果我们忘记了密码,可以使用宏命令来将密码显示出来,然后输入正确的密码即可。具体操作时,要先将宏命令的相关工具按钮调出来。单击文件——选项——自定义功能区——在“开发工具”前打勾——确定。

excel工作表保护密码忘记了怎么办?

单击工具栏——开发工具——宏,新建宏。然后保存。

excel工作表保护密码忘记了怎么办?

编辑该宏,复制下列代码粘贴到宏的内容中去。Sub PasswordBreaker()  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  Fo

编辑该宏,复制下列代码粘贴到宏的内容中去。Sub PasswordBreaker()  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 T

r 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)  ActiveWorkbook.Sheets(1).Select  Range("a1").FormulaR1C1 = 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

o 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)  ActiveWorkbook.Sheets(1).Select  Range("a1").FormulaR1C1 = 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

保存之后,运行该宏,即可弹出显示密码的窗口。单击确定,然后输入密码即可实现解锁。

excel工作表保护密码忘记了怎么办?

如果点击宏时出现错误提示,则可能是因为你的excel没有启用宏。操作方法如下:单击文件——选项——信任中心——信任中心设置——宏设置——点启用所有宏。然后确定。

excel工作表保护密码忘记了怎么办?

Top