1. 首页 > excel教程

撤销工作表保护密码忘记了怎么办(撤销工作表保护密码初始密码)

撤销工作表保护密码忘记了怎么办(撤销工作表保护密码初始密码)

本文主要为大家介绍忘记工作表保护密码怎么办(撤销工作表保护密码初始密码),下面一起来看看具体内容吧。

我们在使用excel工作表的时候可能使用过保护功能,让工作表可以用密码进行保护,防止他人修改,但是这样可能无法进行一些特殊的操作,使用后可能会忘记密码很久。我应该怎么办?如何撤销工作表保护密码?下面我来介绍一下。

如何撤销工作表保护密码:

在2007版Excel表格中可以通过以下方式创建宏:

1、打开Excel表格中的Excel选项,选择自定义,得到如下画面:

2、然后在左侧边栏中选择“查看宏”并双击或选择添加按钮,可以在右侧栏中看到查看宏按钮,然后点击右下角的确定。

3、在下图的窗口中可以看到箭头所指的按钮:点击按钮,会弹出一个窗口:

4. 在宏名称中填写一个名称(可选),然后点击创建,会弹出如下窗口:

5、将窗口中的内容全部选中并删除,然后将下方分界线内的内容复制粘贴到上方窗口中:

撤销工作表保护密码,从横线开始复制

---------------------------------------------- --------------------------------------

选项显式

公共子AllInternalPasswords()

' 打破工作表和工作簿结构密码。鲍勃麦考密克

'可能是为覆盖而修改的基本代码算法的发起者

' 工作簿结构/Windows 密码和多个密码

'

' Norman Harker 和JE McGimpsey 2002 年12 月27 日(1.1 版)

' 由JEM: 于2003 年4 月4 日修改所有消息为常量,并且

' 消除一个Exit Sub(版本1.1.1)

'显示散列密码而不是原始密码

Const DBLSPACE 作为字符串=vbNewLine vbNewLine

Const AUTHORS 作为字符串=DBLSPACE vbNewLine_

'改编自Bob McCormick 基本代码' _

“诺曼哈克和JE McGimpsey”

Const HEADER As String='所有内部密码用户消息'

Const VERSION As String=DBLSPACE '版本1.1.1 2003-Apr-04'

Const REPBACK As String=DBLSPACE '请报告失败'_

“到microsoft.public.excel.programming 新闻组。”

Const ALLCLEAR As String=DBLSPACE '工作簿应该'_

'现在不受所有密码保护,所以确保你:'_

DBLSPACE '立即保存! DBLSPACE '还有' _

DBLSPACE '备份!备份!备份!'_

DBLSPACE '此外,请记住密码是'_

'放在那里是有原因的。不要塞满关键的公式'_

“或数据。”

& 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

  -----------------------------------------------------------------------------------------

  复制到横线以上

  得到情况如下图表示

  6、关闭编辑窗口;

  7、依次点击菜单栏上的工具---宏-----宏,选AllInternalPasswords,运行,确定两次;

  等一会,就会出现以下对话框:这就是Excel密码对应的原始密码(此密码和原先设置的密码都能打开此文档。如果是别人的文档,你又想恢复密码设置,就可以用此密码进行保护,他就能用他设置的密码打开,你可以试试,很有趣的。字母一定要大写):

  再点击确定。Excel的原始密码就被清除了!!

  8、最后记得关闭EXCEL文档时要保存,否则下回打开,文档仍旧处于只读状态而无法修改。

  以上就是有关撤销工作表保护密码的方法介绍,如果大家遇到这种问题,不妨参考本文尝试解决。

关于忘记工作表保护密码怎么办(撤销工作表保护密码初始密码)的介绍到这里就结束了,了解更多办公软件知识可以收藏我们的网站,我们将为你提供更多精彩内容。

本文由李东西发布,不代表东辰网立场,转载联系作者并注明出处:https://www.ktwxcd.com/excel/249943.html

留言与评论(共有 0 条评论)
   
验证码:

联系我们

在线咨询:点击这里给我发消息

微信号:vx614326601

工作日:9:30-18:30,节假日休息