excel表格解除保护的方法
发布时间:2023-11-11 13:01:27
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分钟,再确定。密码撤销完毕。
猜你喜欢
- 在AUTOCAD中随意绘图,复制粘贴至Word2007,发现“图片格式”选项卡未出现,故无法直接裁剪。在AUTOCAD中随意绘图,复制粘贴至
- 想要更换证件照背景怎么做呢?如何实现简单又快速的修改证件照背景色呢?今天小Q教大家使用Word修改证件照背景,自己也能快速操作,再也不用请教
- 简介:word文档中的拼音指南,可以识别你不认识的字。步骤:选中你不认识的字 2.点击拼音指南图标3.
- 在对一些长文章的排版里面,很头疼的是重复劳动、自动化程度不高的问题,其实这些重复劳动是没有必要的,用Word都可以解决这些问题,怎样使用wo
- Word 2010中怎么制作复杂的数学公式?数学公式很复杂,如果word中想要输入一些比较复杂的公式该怎么输入呢?下面我们来看看Word 2
- 在一些数据文档中,特定的单位要上标表示,如果量很大的话一个个输入真的很麻烦。接下来教你word怎么添加上标的小技能,一起来看看吧!批量添加上
- Word文档给文字加拼音怎么加?在我们日常的文档编辑中,有时候会由于一些特殊需求,要在文字上添加拼音,那么应该如何操作呢?其实方法很简单,还
- 如何在Word 2007文档中添加注释?作为编写者和编辑者在后台进行交流的一种方式,Word 2007使您可以将隐藏的注释插入文档中。使用“
- win10相机麦克风权限被关闭怎么办?在使用我们的win10系统的时候,在某些情况下,我们可能会需要用到win10的相机和麦克风。但是我们在
- 编辑Word文档如何想换到新的页面,通常情况下都是敲很多次回车键来生成新的页面。其实不用这么麻烦的,有更简单的方法,另外整理了一些相关的知识
- (1)使用Word 2010打开长篇文档,并将光标定位到放置目录的位置,然后在“引用”选项卡的“目录”选项组中单击【目录】选项组中,单击【目
- 本篇内容主要会向大家介绍word图文混排的设计和制作,设计是需要灵感的,制作要的是细心,大家做图文混排可以先学习下这篇教程。先来看一下做好的
- Excel表格怎么制作倒退日期?Excel表格中想要知足一个倒退日期,该怎么制作呢?下面我们就来看看详细的教程,很简单,需要的朋友可以参考下
- 除了检查和交叉之外,Excel中的复选框还有其他功能吗?事实上,这里有很多东西可以学习,也有很多东西可以创造。今天,我会用这个复选框教你做一
- Word是一款经常使用的办公软件之一,我们为了防止机密泄露,经常会把文档加密,那你知道Word中将文档加密后怎么解开的吗?接下来我们一起往下
- Excel中的左函数、右函数和中函数统称为截取字符串函数。在前面的课程中,王琦老师已经向每个人解释了左函数,今天我将为每个人分析右函数。对应
- 在我们日常的办公软件应用中,往往会用到word转成pdf的情况,有些朋友还是对此毫无了解,今天就带大家了解几种比较常见的word转成pdf的
- 在Excel的应用中,有时候为了更好查找、比较或是显示某一时段、某一内容的数据,我们经常会用到筛选的功能,只需要筛选出自己所需要的数据,把其
- 新建一个空白文档,插入通用表格; 任意点击插入的表格,菜单栏最后会显示“表格工具”和“表格样式”栏目; 第一种方法:在“表格工具”中点击“橡
- excel表格中是没有着重线或者是着重号这一类功能的!只有在word中才有着重线!