excel表格取消保护的方法
发布时间:2023-09-03 02:09:09
Excel中经常需要使用到保护功能进行保护数据,但需要取消保护的时候具体该如何操作呢?接下来是小编为大家带来的excel表格取消保护的方法,供大家参考。
excel表格取消保护的方法:
取消保护步骤1:视图—宏—录制新宏—输入宏名如:aa(aa是可随意输入)
取消保护步骤2:停止录制,这样得到一个空宏
取消保护步骤3:同样视图—宏—查看宏—选aa(aa为之前新建的宏)—点击编辑按钮
取消保护步骤4:删除窗口中的所有字符,复制下面的内容粘贴。一个字母、标点符号都不能少。
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
取消保护步骤5:关闭编辑窗口
取消保护步骤6:视图—宏—查看宏,选AllInternalPasswords,点击执行,确定两次,等2分钟,再确定。密码撤销完毕。


猜你喜欢
- 最近有不少小伙都有下载Win11操作系统,但有的小伙伴在使用搜索栏的时候却发现无法输入任何字母或文字,那么碰到这种情况应该怎么办,下面就和小
- “生成语音”工具可让您粘贴或键入文本,并生成真实的画外音或旁白轨道。该工具使用操作系统提供的库。使用此工具可创建视频、游戏和音频作品的合成声
- 很多用户也都渐渐适应了win8,win8自带有一部分应用,但是有些应用我们用不到,就想要卸载,卸载后实际上并未删除,下面教大家如何彻底的卸载
- Win7旗舰版显示dns配置错误怎么办?相信使用过win7旗舰版的用户可能都或多或少遇到过没有办法正常联网的现象,那么这是因为什么原因呢?通
- IE浏览器显示禁用加载项怎么办?最近有用户打开IE浏览器的时候,上面一直显示禁用加载项的问题,如何解决?系统部落为大家解答。解决办法:1.在
- 今天小编给大家分享一个非常令人兴奋的技能,那就是使用tracert命令查看网络故障。 听完之后是不是很开心?又需要的和小编一起往下看?教程/
- Win10电脑无法使用Alt+Tab切换窗口怎么解决?在win10系统中,我们可以使用Alt + Tab切换任务窗口,因此在操作键盘时无需操
- 如果我们正在使用win10操作系统,对于小娜的使用过程中出现win10小娜提示抱歉我什么也听不见的情况,小编觉得我们可以检查一下是不是自己麦
- Excel中经常需要把数字设置为全部显示,数字具体该如何设置显示全部呢?其实方法很简单,下面是由小编分享的excel设置显示全部数字的方法。
- Win10已经投入很长一段时间了,用的人也用了很久了,从中也遇到各种各样的问题。最近,有用户把系统升级到Win10后,发现IE浏览器的版本也
- 当使用迅雷下载的资源连接不上或下载速度较慢的时候,使用代理服务器来加快下载的速度是许多人的选择。那么,在迅雷X中该怎么设置代理呢?下面小编就
- 利用任务管理器所查看的只是物理内存,如果想查看某软件或系统组件所占的虚拟内存,那就得借助其它方式,不过在win7中通过任务管理器并可轻松查看
- 这篇文章主要介绍了windows如何关闭安全警报及自定义调整安全警报类型,全程操作以图文形式介绍,需要的朋友可以参考下一、关闭安全警报服务我
- 在Windows 11上,Microsoft Hyper-V 功能是一种包含创建和管理虚拟机元素的技术,允许您运行 Windows 11 的
- 相信很多用户在使用电脑的时候经常会遇到各种各样的情况,例如最近一些使用Win10系统的用户发现Werfault.exe占用的CPU非常的高,
- StorDiag.exe 是微软在 Windows 10 周年更新中新添加的存储和文件系统诊断工具,该工具属于命令行系统工具,它主要用于收集
- 在wps表格中,默认是显示状态栏的,如果我们不需要用到状态栏,那么,我们可以将其隐藏,下面就让小编告诉大家怎样隐藏wps表格状态栏。隐藏wp
- 哔哩哔哩直播姬电脑版怎么用?b站直播姬专为哔哩哔哩主播打造,用户可以在电脑上安装此软件实现实时直播,是一款给新主播熟悉使用的obs工具。那要
- 现在微软系统已经更新到了Win10,很多Win7系统用户迫不及待的下载了Win10更新安装包,可是在下载后突然不想使用Win10了,可是又不
- 1、打开WPS。2、点击WPS工具,选择工具。3、点击“备份管理”。4、点击“其它备份”就可以去到备份文件夹。在这里找找,如果有,直接双击打