Excel中表格工作表保护密码撤销的操作方法
发布时间:2023-05-17 09:51:19
excel密码保护
在做excel表格时我们有时候会给自己的工作表加密,一旦忘记密码就会很麻烦,如何绕过密码,直接撤销保护。今天,seo实验室小编就教大家在excel中表格工作表保护密码撤销的操作方法。
Excel中表格工作表保护密码撤销的操作步骤
打开excel,点击菜单栏的“视图”,点击二级菜单里的“宏”,选择录制宏。
表格工作表保护密码撤销的操作图1
在弹出来的方框中输入宏的名称,点击确认。
表格工作表保护密码撤销的操作图2
重复第一步的步骤,不过这次点击“停止录制”。
表格工作表保护密码撤销的操作图3
选择查看宏。
表格工作表保护密码撤销的操作图4
编辑宏。
表格工作表保护密码撤销的操作图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


猜你喜欢
- 相信大家都安装了搜狗、QQ等等的输入法,同时这些输入法里面都自带了英文输入法,每次都切换来切换去的很麻烦,那有又没方法把系统自带的英文输入法
- 电脑时间用长了,C盘中会产生大量的垃圾文件夹,那怎样清理呢?下面结合自己的经验简单的介绍一下。一、清理QQ文件夹和微信文件夹QQ文件夹和微信
- KB5005033是微软最新推出的Win10升级补丁,很多用户在安装升级的时候出现不同的错误0x800f0922、0x8000ffff、0x
- 小翼管家是中国电信推出的一款控制智能家居、家庭云等智慧生活的app,非常的实用。而小翼管家怎么连接机顶盒呢?一起来了解下。小翼管家怎么连接机
- 很多Win10用户在更新TH2 10586(1511)后,电脑会反复出现蓝屏现象,这是为什么呢?因为Windows Update或者NVID
- wps表格是处理数据的一款实用软件,日常办公中,有时我们可能需要在wps表格中输入日期,那么,应该怎样输入呢?下面就让小编告诉你wps表格输
- Beyond Compare是一款功能非常强大的对比软件,它不仅可以对比数据、文件,还可以把文本合并的内容替换掉,Beyond Compar
- Excel2007基础教程:选择特殊类型的单元格在使用Excel 的时候,或许需要在工作表中定位特殊类型的单元格。例如,是否便于定位每个含有
- 今天为大家分享Word自动编号到10以后间距与之前不一致的两种处理方法,对于碰到这类问题却不知道怎么解决的朋友可以参考本文,希望能对大家有所
- Excel是用户工作中都需要用到的办公软件,当你遇到Excel打开全是灰色的,没有办法进行编辑,就算新建表格也是灰色的要怎么办呢?怎么才能进
- Viscosity for Mac是应用在Mac上的一款最好用的Open客户端,与Mac OS X的高级DNS系统完全集成,允许在连接时使用
- 显示打印机错误的原因如下:1、可能是打印机的外壳没有盖紧。2、在打印的时候,一次性进入两张纸,导致通道里面卡纸,就会出现打印机状态错误,把通
- win10电脑网络重置会有什么后果?很多用户发现win10自带一个网络重置的功能,但是不知道使用网络重置会有什么后果,是否会导致网络无法使用
- 散点图(在回归分析中是指数据点在直角坐标系平面上的分布图;通常用于比较跨类别的聚合数据。散点图中包含的数据越多,比较的效果就越好。那么今天小
- 最近很多朋友在玩席德梅尔文明5的游戏时提示错误0xc000142。文明5是一款非常受欢迎的战略游戏,可以让玩家获得非常丰富的游戏体验。然而,
- MID函数可以用来从指定的字符串中截取出指定数量字符的函数,在excel当中该如何使用呢?下面就跟小编一起看看吧。excel使用mid函数的
- 群众币大写 情势在WPS表格中 咱们 该当是见过的, 信赖有 许多人是手打 进去的, 实在 不消 那末 费事, 咱们 能够 经由过程 配置
- Excel表格是一款非常受欢迎的数据处理软件,相信很多人都下载使用过。Excel表格可以将繁杂的数据进行分类存储,便于查找,Excel表格还
- Excel怎么使用数据透视表统计学生的学习评定?想要使用excel做一个学生的学习评定,该怎么统计呢?下面我们就来看看详细的教程,需要的朋友
- 很多Win10用户发现系统分区中有一个Windows10Upgrade文件夹很大,可能有几十个G,非常占空间。Windows10Upgrad