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分钟,再确定。密码撤销完毕。


猜你喜欢
- 以往,为如何多条件求和而烦恼,总是用辅助列,用SumIf()来解决,不尽人意之处太多太多。查过SUMPRODUCT()函数的使用方法,其解释
- WPS文字怎么新建一个空白文档的操作方法分享。我们需要建立一个新的文档内容时,可以直接在软件中进行空白文档的新建。一些新用户不知道怎么新建的
- 电脑上的 Office 软件突然没了出现这种情况,如果只是开始菜单里的程序找不到的话,可以去C盘的目录下的“Microsoft Office
- 一般随着电脑性能不断提高,所以经常会高速运转显卡进行散热,因此这也会导致风险的声音越来越大,所以有部分小伙伴就想要自己去调整显卡的风扇速度,
- Windows7如何彻底删除软件?我们在使用电脑的时候,有时候会无缘无故安装很多没用的软件,删除了过一段时间又出现了,那么Windows7系
- 我们绘制好思维导图后,找到【文件】中的“导入/导出”按钮。 我们点击后,便会看到导出板块,其中展示了许多不同的导出
- 方法一Excel2007及以后的版本,可以直接存为PDF格式。打开需要转换的Excel文件,并调整好格式,如图:
- Microsoft账户是可以在win10系统中登陆的,只是还有很多的小伙伴不知道该怎么去登陆,今天就给你们带来了win10microsoft
- 我们都知道在win系统中我们下载的文件都会在指定的位置,但很多Mac新手用户不知道下载的文件在哪个位置,以至于想要删除最近下载的文件不知道从
- 最近随着Windows11的系统镜像流出,越来越多的小伙伴想要抢先一步下载体验,但是完全找不到Windows11的下载地址,这要怎么办呢?今
- 这篇文章主要介绍了win7禁用u盘软件、win7禁止使用u盘、win7组策略禁用u盘的设置方法,需要的朋友可以参考下现在U盘、移动硬盘等US
- 凤凰新闻如何订阅公众号?凤凰新闻是一款资讯类的APP,用户们可在APP中观看各种新闻资讯,当我们看到好的公众号该如何对它进行关注呢?下面小编
- (原标题:Windows平台现无耻勒索软件,删了文档还索要解锁费用)7月14日消息,据科技网站SlashGear报道,恶意软件一直是计算机界
- 今天我就给大家分享一下非常实用的彻底卸载删除微软Win10易升方法,以后再也不会自动弹出了。下面就和小编一起来看看吧。win10易升控制面板
- Excel表格是一款很多小伙伴都在使用的非常专业的办公软件,在Excel表格中,我们可以进行很多专业化的数据处理。有时候,我们在处理或者是分
- spss统计分析软件除了有主成分分析、因子分析功能之外还有聚类分析的功能,聚类分析能够将物理或者抽象的对象集合分组为由类似的对象组成的多个类
- excel单元格文字怎么添加双下划线?excel合并的单元格输入的文字想要添加下划线,该怎么给文字添加双下划线呢?下面我们就来看看详细的教程
- 今天小编为广大动漫迷带来了一波福利,经典动漫人物壁纸合集分享给大家,每一张壁纸都很经典,每一张都是美好的回忆,废话不多说,快来跟小编看看来吧
- 不管是出现故障的电脑还是新的电脑,我们在使用电脑时,都需要我们去重新安装操作系统。不过现在系统下载的网站很多,有很多小伙伴不知道如何选择下载
- Win10打开网站提示502 bad gateway怎么解决?最近一位Win10用户反馈,浏览器打开网站就提示“502 bad gatewa