Excel撤销工作表保护密码图文教程介绍
发布时间:2022-04-20 04:41:17
Excel中有工作表保护功能,就是可以将工作表用密码保护起来,以防别人操作时进行修改,但是这样一来有可能会无法进行一些操作(如输入公式等),时间久了保护的密码也有可能忘记了,这该怎么办呢?只要按照以下步骤操作,Excel工作表保护密码瞬间即破
我们经常使用Excel的工作表保护功能,将工作表用密码保护起来,以防别人操作时进行修改,但是这样一来有可能会无法进行一些操作(如输入公式等),时间久了保护的密码也有可能忘记了,这该怎么办呢?只要按照以下步骤操作,Excel工作表保护密码瞬间即破!
1、打开您需要破解保护密码的Excel文件;
2、依次点击菜单栏上的工具---宏----录制新宏,输入宏名字如:aa;
3、停止录制(这样得到一个空宏);
4、依次点击菜单栏上的工具---宏----宏,选aa,点编辑按钮;
5、删除窗口中的所有字符(只有几个),替换为下面的内容;
从横线下开始复制-----------------------------
Option Explicit
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
----------------------
复制到横线以上
6、关闭编辑窗口;
7、依次点击菜单栏上的工具---宏-----宏,选AllInternalPasswords,运行,确定两次;


猜你喜欢
- 很多用户们在使用电脑的时候,发现电脑中有着几种不同的电源模式等,但是其中的休眠和睡眠模式受到玩家们的好奇等,那么这两种模式到底有什么区别呢,
- 这篇文章主要介绍了Windows任务管理器没有菜单栏的解决方法图文教程,小编就经常会遇到这个情况,其实还原方法很简单,看完本文你也会的,需要
- wps演示是一款强大的办公软件,我们可以使用wps演示来制作ppt幻灯片,具体的操作是怎样的呢?下面就让小编告诉你wps演示如何制作ppt文
- 1.打开Excel表格,点击需要快速输入欧元符号的单元格。 2.接着按住“Alt”键,然后输入数字“0128”,输
- 腾讯文档PC客户端是一款专门用于文本编辑的软件,简单易上学,小白也可以轻松使用,下文中主要介绍了在腾讯文档中导出文档保存到本地的详细步骤,感
- 这篇文章主要介绍了若任务管理器被病毒禁用导入本注册表可解开 reg,需要的朋友可以参考下复制代码代码如下:Windows Registry
- 在各类演讲、比赛中,经常要求比赛选手要在规定时间内完成演讲,于是,组办方就需要在PowerPoint演示中安装“倒计时”,用以提醒演讲者。在
- 很多朋友使用新的Win11系统需要进行一些设置,但是找不到设置图标,想要知道如何才可以进入设置界面,这个问题比较简单,系统之家小编有好几个方
- 当您为公司的未来做计划时,最好能准确而最新地表明公众对未来的经济表现有多乐观或悲观。会议委员会,密歇根大学,拉斯穆森报告(Rasmussen
- 每次微信都会更新许多的新表情让每个用户方便使用,但是还是有许多的用户不知道这些表情的含义,今天就给你们带来了微信新表情意思详情介绍,快来看看
- 作为一名小编,有一个趁手好用的文字编辑软件是非常重要的,《Ulysses》这个软件,它可以说是最为便捷的文字创作与管理 App 之一了。它支
- 目前win11还只有dev版本,所以其实大家只能选择它,在月底微软会推迟Bata测试频道,大家可以根据需要进行选择,这里小编就为大家详细的介
- 天气通app中怎么添加新城市?天气通顾名思义就是一款关于天气信息的软件。去到了一个新的城市,想要在天气通app中添加新城市,具体该怎么操作?
- 第1步,打开Word2010文档窗口,依次单击“文件”→“选项”按钮,如图1所示。 图1单击“选项”按钮第2步,打
- 有些用户反馈电脑运行时,发现系统文字变得模糊不清晰,这是怎么回事?一方面是更换了显示设备,分辨率不足导致,也有可能是视力产生问题不再适应之前
- Microsoft Outlook 2019 for mac中协作也是一项很重要的功能,接下来macdown小编给大家图文展示一下Micro
- win7时间怎么自动校准到桌面?有许多用户都想要知道win7的时间要怎么才能够自动校准,这个时间的自动校准设置很多用户可能不知道要怎么才能够
- proflwiz.exe是微软Microsoft Office家族标识转换工具进程文件: proflwiz or proflwiz.exe
- 鼠标灵敏度的参数会直接影响着我们的使用体验,最近有很多新安装Win11,不知道Win11系统的灵敏度怎么调,其实我们只需要进入设备设置选项,
- 谷歌浏览器是一款很多用户都喜欢使用的浏览器之一,而我们在使用谷歌浏览器的时候除了可以用鼠标快速对网页进行一些操作之外,还能够通过设置快捷键来