EXCEL表格忘记密码如何解决?EXCEL表格清除密码方法
发布时间:2022-02-26 09:02:52
EXCEL表格在日常的办公中经常会使用到,并且平时如果有制作一些重要的数据我们都会给它加上密码来保护数据。但是设置了密码时间久之后忘记了,这是很多朋友出现的情况。因此我们可以选择EXCEL表格清除密码方法来解决。
1、打开EXCEL表格,选择视图,宏,录制新宏,新建一个宏;
2、先生成一个空的宏;
3、编辑这个宏,选中刚新建的宏后点击编辑按钮;
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这个编辑好的宏,执行,并且确定数次,就OK了。


猜你喜欢
- Excel中的分栏打印具体该如何实现呢?下面是小编带来的关于excel2003实现分栏打印的方法,希望阅读过后对你有所启发!excel200
- 在办公中总是有无数个Excel表格要做,不仅要有序排列,还有很多需要注意的事项,那我们该怎样快速有效的去完成对数据的统计了?接下来看看小编整
- 很多用户们在使用电脑的时候,碰到了一个问题,就是win10系统在待机状态下的时候,鼠标失灵了,怎么动鼠标都没有反应,这个问题需要怎么解决呢,
- edge浏览器是微软系统自带的网页浏览器,用户经常用edge浏览器来看视频,但是最近有用户发现自己使用edge浏览器看视频经常黑屏,导致体验
- Studio One mac是一款运行在Mac平台上的音乐创作与制作软件,Studio One 3 Mac版集MIDI和音频功能于一身,还有
- 本文介绍Microsoft Excel中IMSUB函数的语法和用法。函数说明IMSUB函数的主要作用是返回以 x+yi 或 x+yj 文本格
- 偶尔不小心点到一键还原命令时,那就更加的无语了,那么怎么样才能够把一键还原命令隐藏起来,不会碰到呢?为此苦不堪言的朋友可以阅读下本文或许对你
- 有的时候我们会想要更换一下电脑上某个软件的图标,但是很多小伙伴们并不会操作,下面我就来为大家介绍下该如何操作?具体步骤如下:打开桌面,找到要
- 联想thinkpadx1是一款性能非常强大的商务办公笔记本电脑,搭载了intel第十一代酷睿i5处理器以及发烧级独立显卡,能够让用户们有着不
- 相信有不少用户使用的电脑都是笔记本电脑,而最近不少用户重启电脑开启移动热点之后,发现电脑无法联网,找了一圈也不知道是什么原因,其实这是微软最
- 现在越来越多的人喜欢用wps了,因为比较简便,在使用wps表格的时候,在单元格输入的字比较多,希望能够有自动换行的功能。那么,wps自动换行
- 在制作幻灯片时,通常需要为每张幻灯片都设置一些相同的内容或格式以使演示文稿主题统一。例如,在每张幻灯片中都加入公司的Logo,且每张幻灯片标
- Word窗口中的菜单栏作用非常大,如果菜单栏不见了,我们可能会有许多任务都无法完成。笔者以前就遇见过这样一间事。有一次使用 Word2003
- 微软正在测试通过Windows Update分发Win10技术预览版,如果一切顺利,Win10正式版也将通过Windows Update的方
- 微信编辑器是美化微信公众号文章的在线文字处理工具,通过其处理过的文章往往有着让人着迷的色彩和布局作用,网络上有很多不同的微信编辑器,我们就以
- 很多使用win10系统的小伙伴,使用电脑的时候发现网速特别慢。这是什么情况呢?可能是你网络设置里面对网络有一定的限制,今天小编教你们如何解除
- 说起“iOS 越狱”和Cydia商店,很多“老果粉”们肯定相当的熟悉。但随着时间的推移,关于越狱的消息越来越少,如今的人们已经不像当年那样热
- 第一,什么是加权平均数通过3个简单举例来认识什么是加强平均数。1.吃三碗的有4人,吃两碗的有5人,吃一碗的6人。平均每人吃多少?加权平均数公
- 昨天,苹果给大家推送了iOS 16.3 Beta 2更新。虽然本次 iOS 16.3 Beta 2 并没有带来什么新功能,但针对 SOS 紧
- Excel是三大办公软件之一,它主要的作用在于数据的分析、整理、查看、统计、对比等。在excel中经常需要搜索一些关键词来查找数据,下面小编