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分钟,再确定。密码撤销完毕。
猜你喜欢
- 1、用Word2013打开一篇文档,将光标定位到我们需要插入公式的位置,并切换到“插入”选项卡,我们现在选择“符号”选项组中的“公式”命令,
- Word报刊段落头文字大字效果该怎么设置?word中想要给文章段落制作一个效果,就是首字下沉的效果,该怎么制作呢?下面我们就来看看详细的教程
- 垂直区域 | 水平区域 | 混合区域 | 不连接区域 | 填充Excel区域 | 移动Excel区域 | 拷贝EXCEL区域Excel 区域
- 1、先来看一下,我建立了很多工作表,大概有十几个 2、在左下角有一个绿色小三角,点击这里可以切换不同的工作表,你左
- 在word中插入大量的图片会导致文档占用空间过大,这样在文件传输都不是很方便。而我们在能节约的情况下对word中所有图片进行批量化的压缩,这
- 在使用Win10系统的时候,经常会因为一些程序不兼容系统而收到Windows错误报告,大多数时这些错误报告没有什么用处,那么要如何去关闭它呢
- 用户在word软件中收获到了许多功能的帮助,让用户在编辑文档时可以简单轻松许多,因此这款办公软件已经是众多上班族的必备办公软件了,当用户在编
- 1、第一步先打开word文档,然后可以看到在页面的上方没有“表格工具”。2、然后点击页面上方的“插入”按钮,然后选择点击“表格”按钮,然后任
- 有时,当尝试利用现有数据去制作一个Excel图表时,直观感觉很简单,但实际操作起来却非常茫然,不知从何入手,如图8.2-1所示的案例即是一个
- 这篇文章主要介绍了excel打印技巧大全 十二个必备Excel打印技巧汇总的相关资料,需要的朋友可以参考下本文详细内容介绍职场办公中,Exc
- 电脑是现在很多用户在工作、生活中都会用到的设备,在操作电脑的时候用户会经常查看时间、日期等数据,为了方便自己查看我们可以设置数据的格式为自己
- Word文档打印怎么设置彩色?很多用户在使用Word编辑好文档之后,会直接将其打印出来,但是一般默认打印都是黑白的,那么应该如何设置彩色打印
- win10的控制面板是Windows图形用户界面一片面,可通过开始菜单访问。它允许用户稽查并变动基本的系统配置,好比增加/删除软件,掌握用户
- 有时候我们在网络上下载过来的文档,烙上了水印,这时我们第一时间就是把水印去掉,但这水印又不是图片上,该怎么去掉呢?文档去水印具体步骤:打开带
- 我们在录入文字到文档的时候,或者是复制网上内容时,都会带有格式,有时候还会遇到删除不掉的水印。今天就给大家分享word文档如何删除水印的小技
- “自动编号时,复制格式后编号数字始终是连续的,有么有?可我想在第二章节重新排序号、更新编号的起始数值呀?”
- 从2020年1月14日起,微软宣布正式停止对win7系统的支持,那么win7系统的安全补丁和升级就不会发生。而且,继续使用win7系统将大大
- Excel表格数据统计常常都会用到,有了统计函数,分析数据也轻松不少。那么有哪些统计函数呢?下面给大家分享Excel常见的统计函数汇总。1、
- 王海是某某公司的销售部经理助理,现在要统计分析当年各业务员的销售情况,以便了解业务员的销售能力,调整他们的业务范围和职位。现在,王海将这一年
- 很多人会问默认网关是什么,默认网关就是我们现在的电脑主机使用的网关。有朋友在使用Win10系统运行Internet连接的时候出现提示,Win