Excel—“撤销工作表保护密码”的破解并获取原始密码

在日常工作中,您是否遇到过这样的情况:您用Excel编制的报表、表格、程序等,在单元格中设置了公式、函数等,为了防止其他人修改您的设置或者防止您自己无意中修改,您可能会使用Excel的工作表保护功能,但时间久了保护密码容易忘记,这该怎么办?有时您从网上下载的Excel格式的小程序,您想修改,但是作者加了工作表保护密码,怎么办?您只要按照以下步骤操作,Excel工作表保护密码瞬间即破!

1、打开您需要破解保护密码的Excel文件;

2、依次点击菜单栏上的工具---宏----录制新宏,输入宏名字如:aa;

3、停止录制(这样得到一个空宏);

4、依次点击菜单栏上的工具---宏----宏,选aa,点编辑按钮;

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、关闭编辑窗口;

7、依次点击菜单栏上的工具---宏-----宏,选AllInternalPasswords,运行,确定两次;

等一会,就会出现以下对话框:这就是Excel密码对应的原始密码(此密码和原先设置的密码都能打开此文档。如果是别人的文档,你又想恢复密码设置,就可以用此密码进行保护,他就能用他设置的密码打开,你可以试试,很有趣的。字母一定要大写):

再点击确定。Excel的原始密码就被清除了!

破解Excel受保护文件相关推荐

  1. 大多数的愤怒源于自己的无知——《Excel受保护视图》

    从公司内网中下载了几个文件一直没来得及看,晚上突然看到,就打开来看,然而,却出现了这样的情况: 正在受保护的视图打开,一开始没明白啥意思,心里想着,应该是这文件的来源不太可靠,也是,公司内网,Exce ...

  2. 破解excel格式保护

    #筛选用 import pandas as pd import numpy as np import re #pd.options.display.max_columns = None pd.set_ ...

  3. Excel受保护的工作表怎么操作?

    excel文件不能编辑.不能复制等编辑操作,这都是因为文件设置了excel保护工作表.这种保护是一种很有效的.对excel文件数据的一种保密方式,因为设置了excel保护工作表,我们可以打开阅读文件, ...

  4. VBA破解Excel表格保护密码

    Alt+F11打开VBA编辑程序 打开模块编辑,输入以下代码: Sub 破解()ActiveSheet.Protect DrawingObjects:=True, CONTENTS:=True, Al ...

  5. win7 隐藏受保护的操作系统文件 消失

    检查注册表中以下键值: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Su ...

  6. 破解受保护的excel中的密码

    今天朋友给我发了一张excel表,她说不能删除数据,让我帮忙弄弄,我当时就觉得这张表应该是受到保护了,就在视图选项中准备撤销保护,但是却需要密码,后来在网上查找了 下资料,发现有个方法可以将密码破解出 ...

  7. 如何破解受保护的excel密码

    首先,打开受保护的Excel表格,按"ALT"+"F11"键,弹出如下的界面. 点击"插入"--"模块",出现下图 ++ ...

  8. 如何取消EXCEL文件的“受保护的视图“

    如何取消EXCEL文件的"受保护的视图" 背景 解决方案 背景 我们在导出或下载的EXCEL文档时,文档会以"受保护的视图"的模式打开,这是为了保护我们的电脑免 ...

  9. 如何[破解]观看加密受保护的视频文件

      如何 [ 破解 ] 观看加密受保护的视频文件 一 , 修复系统「数字管理组件」 DRM 由于加密视频使用了

  10. excel文件被写保护怎么解除_excel表格受保护怎么解除保护

    回答:总结一下几种现象:1:CAD中毒.打开CAD安装文件夹,看看是不是有个aCAD.lsp,删掉.2:块定义好以后,改变了他的比例,可以在属性里面将比例修改为1,1,1 . 附个图给你看看.3:嵌套 ...

最新文章

  1. UESTC-1057 秋实大哥与花(线段树+成段加减+区间求和)
  2. 使用nLite集成驱动教程
  3. Func与Action
  4. k8s v1.9.6 超详细搭建步骤
  5. 无休止加班的真正原因!你们公司是这样吗?
  6. r 多元有序logistic回归_R语言多分类logistic逻辑回归模型在混合分布模拟单个风险损失值评估的应用...
  7. 【赠书】快速入门自动机器学习!自动机器学习(AutoML):方法、系统与挑战 图书赠送!...
  8. 浅谈Spark应用程序的性能调优
  9. java string 不变_为什么String在java中是不可变的?
  10. nginx location 正则表达式匹配多个地址_就是要让你搞懂Nginx,这篇就够了!
  11. day 107radis非关系型数据库
  12. 【论文写作】毕业论文写作套路之参考文献
  13. 计算机主机系统总线,全国2009年10月高等教育自学考试计算机应用基础试题及答案...
  14. C# dataGridView控件 左上角加string
  15. 计算机网络工程税收分类编码,税控开票系统商品和服务税收分类编码操作手册...
  16. 中国风歌曲介绍及推荐
  17. 济安横断面怎么去水印_济安横断面设计软件
  18. [我参加NVIDIA Sky Hackathon](模型训练ssd系列)
  19. bug---springboot报错Consider the following: If you want an embedded database (H2, HSQL
  20. 当今程序员很厉害?不!那是你不了解上古时期的那些神级操作

热门文章

  1. Ubuntu 安装 ROS 详细教程
  2. java计算机毕业设计基于安卓Android的团务智慧管理APP
  3. 1.深入浅出:理解三极管截止、放大和饱和状态!——参考《模拟电子技术基础》清华大学华成英主讲
  4. mysql批量导入csv数据_csv批量导入mysql命令
  5. 北大医学英语和计算机,医学英语专业本科生张泉同学在SSCI期刊发表论文
  6. HTTP协议发展历史
  7. matlab node._matlab调用ansys
  8. numpy中的multipy, matmul, dot的区别
  9. 计算机图学与工业设计,工业设计和工程制图的关系
  10. OFDM学习笔记(七)(多址接入技术)