相信身边很多日常需要用到Excel的上班党或者学生党来说,自己可能会有一些比较重要的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这个编辑好的宏,执行,并且确定数次,这样就可以啦。
相关推荐
在本文中,我们介绍了使用VBA破解Excel密码宏程序的方法,并提供了破解Excel密码宏程序的代码。此外,我们还介绍了使用AllInternalPasswords宏破解Excel密码宏程序的方法。这些方法可以帮助我们快速破解Excel文件的...
excel密码破解,excel密码破解,excel密码破解
Word和Excel密码破解 Wordl密码破解 Excel密码破解
破解EXCEL密码 在本文中,我们将讨论如何破解EXCEL密码,特别是针对EXCEL 2003和EXCEL 2007版本的破解方法。需要注意的是,这个方法不是为了找出密码,而是去除密码保护,使得用户可以自由地访问和编辑Excel文档。 ...
破解excel密码以及解除密码
破解Excel密码的工具 破解Excel密码的工具
本文档“如何破解EXCEL密码.pdf”提供了使用VBA宏来解除Excel密码保护的方法。以下是该方法的详细步骤和知识点: 1. **VBA宏**:VBA(Visual Basic for Applications)是Microsoft Office套件中的编程语言,允许...
Py破解Excel打开密码(纯数字)源码,运行环境:python
这篇教程主要介绍了如何使用宏来破解Excel密码,这是一个技术性的话题,涉及到Excel的安全性和VBA编程。 首先,我们要明白,这个方法并不是针对所有类型的密码保护都有效,特别是那些使用了复杂加密算法的现代版本...
破解EXCEL密码(无需任何工具)借鉴.pdf
通过vba破解excel密码保护,解压:csdn_fls 通过'开发工具'copy该代码执行
### EXCEL密码保护破解知识点详解 #### 一、背景与目的 在日常工作中,我们经常使用Excel来存储和处理各种敏感或重要的数据。为了保护这些数据的安全性,用户可能会为Excel文档设置密码保护。然而,在某些情况下,...
5秒内破解wordexcel密码
总结,利用宏破解Excel密码是一种技术手段,但它涉及对数据保护的尊重和法律合规性。在实际操作中,必须确保有合法的理由和责任去解除密码保护,并且理解这可能带来的风险。在大多数情况下,寻找其他合法途径获取...
资源为最简单的破解excel工作表保护密码的方法,根据图片文件的操作步骤,分分钟搞定excel密码破解。超级简单方便。
用宏快速破解excel密码,将代码做成宏运行,即可破解excel的保护码
只可破解Word2003和Excel2003以下版密码破解