Excel密码忘记:破解Excel密码

Excel保护密码是用来防止别人修改Excel文档用的,但有时连自己都忘了,那该怎么办呢?

 

破解方法:

打开需要破解的excel文档,然后按Alt+F11打开VBA编辑器,点击插入-模块,在模块中将以下代码COPY进去,无需保存,直接按F5运行,等待运行完毕。大约等待2分钟左右,密码被计算出来,并且显示出原密码,文档也变成未设密码状态。

(注:复制代码时按下面代码区域右上角的第二个按钮。)

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

破解如此简单。有了这个方法,那Excel文档保护功能就是形同虚设。

【测试使用Excel2003版本,通过。】

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索string
, passwords
, for
, next
, integer
Chr
,以便于您获取更多的相关知识。

时间: 2024-09-19 09:42:58

Excel密码忘记:破解Excel密码的相关文章

Mac操作系统下MySQL密码忘记后重置密码的方法_Mysql

安装好MySQL以后,系统给了个默认的的密码,然后说如果忘记了默认的密码......我复制了默认密码就走过了只一步,这一步就是我漫长旅程的开始.他给的密码太复杂了,当然我得换一个,而且我还要假装我不记得密码了,就这样我走上了不归路...... 这个过程是心酸的,网上的资料多如狗,关键是各有各的错法,尝试了半天没一个对的,在即将打破心理防线,要去翻MySQL文档的时候,我改成功了.没有一个文章告诉我完整的答案,我是参考了好几个攻略,闭门造出来的车.给自己点赞.废话不多说,一步一步跟我走. 关闭my

wifi密码怎么破解?无线密码破解的方法教程

第一步:破解工作所需要的装备:带无线网卡的电脑(无线网卡必须兼容BT3).2G以上U盘一个.BT3.spoonwep2破解软件. 注:BT3 全称BackTrack3,是集成了一些计算机安全软件的linux系统.spoonwep2就是破解软件,一个非常强悍的图形化破解WEP无线网络密码的工具. 第二步:安装软件BT3 1:将U盘格式化,文件系统选为FAT32. 2:将BT3解压后复制到U盘,完成后会看到U盘目录下有两个文件夹,一个boot 一个BT3. 3:安装BT3系统.点击开始-运行,输入C

Excel文件密码忘记了该怎么办呢?

对于不想让别人看到的数据, 很多人喜欢加密Excel文件, 但如果很久不用, 可能自己都忘记密码了. Excel文件忘记密码了该怎么办呢? Excel加了密码的文件, 推荐使用使用软件 "Office Password Remover"破解,这个软件能破解Word.Excel和Access文档密码, 而且速度很快,一般情况下解密过程要要几秒钟就行了. 这个软件可以在网上搜索一上, 有很多破解版的可以下载, 这里就不提供下载了. 安装很容易, 一路Next就行了. 该软件下载并安装后,会

excel密码忘记了怎么办

  方法一:第三方Office Password Remover 软件 通过数据丢失我们会向导用第三方数据恢复软件来进行修复,而密码忘记了,我们也可以采集第三方工具破解密码的方式来解决.这里推荐大家使用office2003版: Password Remover2.0软件. Office Password Remover 是一款可以瞬间破解 Word.Excel和Access 文档密码的工具,一般情况下解密过程不超过5秒,而且操作简单,无需设置.但是使用本软件需要连接到互联网,因为要向软件服务器发

Excel撤销工作表保护密码图文教程介绍

  我们经常使用Excel的工作表保护功能,将工作表用密码保护起来,以防别人操作时进行修改,但是这样一来有可能会无法进行一些操作(如输入公式等),时间久了保护的密码也有可能忘记了,这该怎么办呢?只要按照以下步骤操作,Excel工作表保护密码瞬间即破! 1.打开您需要破解保护密码的Excel文件; 2.依次点击菜单栏上的工具---宏----录制新宏,输入宏名字如:aa; 3.停止录制(这样得到一个空宏); 4.依次点击菜单栏上的工具---宏----宏,选aa,点编辑按钮; 5.删除窗口中的所有字符

Excel保护工作簿并加密码动画教程

<Excel2003入门动画教程43.Excel保护工作簿并加密码>. 演示动画 操作步骤 如果我们不希望别人采取前面的方法整体移动或复制工作表,我们就将工作簿保护起来. 启动Excel,打开需要保护的工作簿文档,执行"工具→保护→保护工作簿"命令,打开"保护工作簿"对话框,选中相应的选项,输入密码,按下"确定"按钮,再确认需要一次密码,确定返回即可. 经过这样的设置后,就不能对工作表进行整体移动和复制了.

开机密码忘记怎么办?介绍几种密码破解方法

不管是你忘记了密码还是不怀好意,总之破解一个你不知道密码的Windows是一件很简单的事.这里有详细的教程,还包括如何在你自己的计算机上避免这类事情的发生. 这里有好几种方法破解一台电脑,各有长短.我们挑选了三种比较流行的方法,并列出他们的优缺点,这样你可以根据实际情况选择--还有根据他们的缺点进行防护. 最懒的办法:用一张Linux Live CD获取文件 如果你不想进入系统,而只是想获取些文件,就没必要搞得那么麻烦了,随便拿一张Linux live CD进去后把文件拷到优盘上就行了.就跟你用

苹果iPhone6锁屏密码怎么破解?iphone锁屏密码忘记解决办法

一些粗心大意的苹果用户可能会遇到了这样的问题,iPhone6忘记了锁屏密码怎么办?遇到了这种情况,其实可以试试一些操作比较简单的iPhone6锁屏密码破解方法来解决这个问题,下面我们就一起来看看小编整理出来的iPhone6锁屏密码破解教程,有需要的可以来参考参考.   [iPhone6锁屏密码破解教程 iPhone6忘记锁屏密码解决方法] 如果您输入错误密码六次或以上,将看到以下任一消息: iPhone已停用 iPad已停用 iPod touch已停用 如果您之前将设备与iTunes同步过,您或

路由器密码忘记 五步暴力破解

我是一名家庭用户,最近不小心忘记了家里无线路由器的登录密码,现在唯一知道的就是该设备使用的是5位以内的数字作为密码, 那么我想问专家如何来解决这种密码为纯数字的暴力破解问题呢?在线急切等待.[解答]很 多时候我们家庭用户网络被入侵或者日常使用过程中都会遇到密码猜解的问题,家庭宽带路由器的密码遗忘而又无法通过其他办法恢复的话,暴力破解方法是唯一的选择. 但是从以往的经验 来看暴力破解密码工程庞大,所需要的时间非常长,小则几十小时多则 几天,而且成功率还不高.不过就笔者长期经验来说如果我们要破解的密

不知道或忘记或破解Vista密码的方法_Vista

做为系统管理员,如果忘记Vista登录密码,难道只能重装吗?当然不是,下面介绍两种破解方法希望对大家有所帮助. 请先将Vista安装盘放入光驱,重新启动计算机,在CMOS中进行设置以光驱启动. 1.当出现安装界面时,请单击"Repair your computer"(修复系统),在随后弹出的对话框中选择"Command Prompt"(命令提示符). 2.在调用了系统的命令提示符窗口后,请输入"mmc.exe"命令并按回车键,系统将会调用出控制台