当前位置:首页 > 电脑教程 > 办公教程 > 正文内容

破解密码保护的Excel文件方法,Excel文件密码破解教程

seoxyz14小时前办公教程4

碰到加密的 Excel 文件,不知道密码可真让人头大!别着急,下面就来教你几招,轻松破解它的密码保护。

破解密码保护Excel文件的方法


  方法一,要是我们知道密码,直接打开Excel,点“工具”――》“保护”――》“撤消工作簿保护”,弹出窗口后输入密码就行。


  告诉你破解密码保护的excel文件


  告诉你破解密码保护的excel文件


  方法二,没有密码的话,我们可以用“宏模块”来破解,具体步骤看下面。


  1、打开要处理的Excel文件,然后按“ALT”+“F11”,就像下图那样。


  告诉你破解密码保护的excel文件


  2、接着点菜单上的“插入”――“模块”,如图所示。


  告诉你破解密码保护的excel文件


  告诉你破解密码保护的excel文件


  3、把下面这段代码复制,粘贴到空白的地方;


  告诉你破解密码保护的excel文件


  代码如下


  复制代码


  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 & "


&\#x22; &\#x26; DBLSPACE &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x22;Note it down for potential future use in other workbooks by &\#x22; &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x22;the same person who set this password.&\#x22; &\#x26; DBLSPACE &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x22;Now to check and clear other passwords.&\#x22; &\#x26; AUTHORS &\#x26; VERSION&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Const MSGPWORDFOUND2 As String=&\#x22;You had a Worksheet &\#x22; &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x22;password set.&\#x22; &\#x26; DBLSPACE &\#x26; &\#x22;The password found was: &\#x22; &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;DBLSPACE &\#x26; &\#x22;
" & 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, _


  "


&\#x22;, PWord1), vbInformation, HEADER&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Exit Do &\#x27;Bypass all for...nexts&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;End If&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;End With&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Next: Next: Next: Next: Next: Next&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Next: Next: Next: Next: Next: Next&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Loop Until True&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;On Error GoTo 0&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;End If&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;If WinTag And Not ShTag Then&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;MsgBox MSGONLYONE, vbInformation, HEADER&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Exit Sub&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;End If&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;On Error Resume Next&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For Each w1 In Worksheets&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x27;Attempt clearance with PWord1&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;w1.Unprotect PWord1&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Next w1&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;On Error GoTo 0&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;ShTag=False&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For Each w1 In Worksheets&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x27;Checks for all clear ShTag triggered to 1 if not.&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;ShTag=ShTag Or w1.ProtectContents&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Next w1&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;If ShTag Then&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For Each w1 In Worksheets&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;With w1&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;If .ProtectContents Then&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;On Error Resume Next&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Do &\#x27;Dummy do loop&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For i=65 To 66: For j=65 To 66: For k=65 To 66&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For l=65 To 66: For m=65 To 66: For i1=65 To 66&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For i2=65 To 66: For i3=65 To 66: For i4=65 To 66&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;For i5=65 To 66: For i6=65 To 66: For n=32 To 126&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;.Unprotect Chr(i) &\#x26; Chr(j) &\#x26; Chr(k) &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Chr(l) &\#x26; Chr(m) &\#x26; Chr(i1) &\#x26; Chr(i2) &\#x26; Chr(i3) &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Chr(i4) &\#x26; Chr(i5) &\#x26; Chr(i6) &\#x26; Chr(n)&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;If Not .ProtectContents Then&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;PWord1=Chr(i) &\#x26; Chr(j) &\#x26; Chr(k) &\#x26; Chr(l) &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Chr(m) &\#x26; Chr(i1) &\#x26; Chr(i2) &\#x26; Chr(i3) &\#x26; _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;Chr(i4) &\#x26; Chr(i5) &\#x26; Chr(i6) &\#x26; Chr(n)&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;MsgBox Application.Substitute(MSGPWORDFOUND2, _&\#x3C;/p&\#x3E; &\#x3C;p&\#x3E;&\#x3000;&\#x3000;&\#x22;
", 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


  4、好了,确定没问题后按一下“F5”运行宏模块,开始密码破解。先点击确定,之后就能看到红框处的密码数字了


  告诉你破解密码保护的excel文件


  告诉你破解密码保护的excel文件


  5、完成之后,再去尝试编辑Excel,就不会有任何问题了哦。


  需要注意的是,破解他人加密的Excel文件可能会涉及隐私问题,一定要在合法合规的前提下使用这些方法,可不能乱用哦。


  你有没有遇到过破解Excel密码的情况呀?用这些方法尝试的时候顺利吗?可以在评论区说说你的经历。


相关文章

wps幻灯片如何插入模板,怎样添加多个不同模板

wps幻灯片如何插入模板,怎样添加多个不同模板

想让你的WPS幻灯片看起来更丰富吗?试试插入多个不同模板吧,方法其实很简单哦。WPS幻灯片插入多个不同模板的步骤在PPT里,用不同模板能让幻灯片好看不少,WPS插入不同模板也挺方便的。1、先打开WPS...

PPT段落起始编号怎么设置,修改方法教程

PPT段落起始编号怎么设置,修改方法教程

  还在为PPT段落编号混乱发愁吗?来看看怎么设置修改起始编号吧!首先,我们有一张编辑好内容的PPT,像图里这样,标题、小标题和段落内容都有了,就是没给段落编号,是不是看着挺拥挤的呀  为小标题添加项...

如何快速分散Excel单元格文字,Excel文字逐个分开技巧

如何快速分散Excel单元格文字,Excel文字逐个分开技巧

你是不是也遇到过这样的情况?想把 Excel 一个单元格里的文字逐个分开,却不知道该咋弄。别着急,下面就来给你说说几个方法。利用MID函数分散文字用mid函数,也就是=mid(a,m,n),它能帮我们...

Excel2016中关闭工作簿不退出怎么设置,设置方法是什么

Excel2016中关闭工作簿不退出怎么设置,设置方法是什么

在使用Excel2016时,你是不是也遇到过关闭工作簿就把整个Excel都关掉的情况?别急,下面教你设置成只关工作簿不退出软件,超方便!设置关闭工作簿而不退出Excel的步骤  1、用鼠标左键双击电脑...

如何设置Excel2016的默认保存格式,Excel2016保存格式设置教程

如何设置Excel2016的默认保存格式,Excel2016保存格式设置教程

  还在为Excel2016默认保存格式不是自己想要的而烦恼吗?别着急,今天就来教你怎么设置,让每次保存都更省心。Excel2016设置默认保存格式步骤  1、在电脑桌面上找到Excel2016的程序...

Excel中日期下拉菜单怎么设,下拉选择日期的操作方法

Excel中日期下拉菜单怎么设,下拉选择日期的操作方法

想在Excel里弄个能选日期的下拉菜单,又不想加日历控件,该咋整呢?别急,下面就来教你简单的办法。设置数据有效性的前期操作1. 先把Excel文档打开,然后点“数据”,再点“数据有效性”,就像下面图里...