管理员:【menu】->【ok】 8181

作者:胡杨
链接:https://www.zhihu.com/question/37928349/answer/257244089
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

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

在日常工作中,您是否遇到过这样的情况:您用Excel 编制的报表、表格、程序等,在单元

格中设置了公式、函数等,为了防止其他人修改您的设置或者防止您自己无意中修改,您可

能会使用Excel 的工作表保护功能,但时间久了保护密码容易忘记,这该怎么办?有时您从

网上下载的Excel 格式的小程序,您想修改,但是作者加了工作表保护密码,怎么办?您只

要按照以下步骤操作,Excel 工作表保护密码瞬间即破!

1、打开您需要unlock保护密码的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

5.依次点击菜单栏上的工具---宏-----宏,选AllInternalPasswords,执行,确定两次; 
耐心等一会,再点击两次确定,就ok啦!

deli考勤机3960操作手册相关推荐

  1. 最好的程序界面就是用户无需去阅读操作手册就知道该如何使用的界面

    最好的程序界面就是用户无需去阅读操作手册就知道该如何使用的界面. 原则 1.一致性  如果你可以在一个列表的项目上双击后能 够弹出对话框,那么应该在任何列表中双击都能弹出对话框.要有统一的字体写号.统 ...

  2. git操作手册_基本的Git手册

    git操作手册 介绍 (Introduction) Hi! I am Sanjula, and in this guide I hope to teach you a little bit about ...

  3. v2视频服务器退出系统怎么启动,V2视频会议系统入门操作手册.doc

    V2视频会议系统入门操作手册 登陆方式 打开IE(浏览器),用户访问服务器地址00,进入V2 Conference系统主界面. 首次登录视频会议服务器,系统会自动提示客户端下载安装客户端插件,用户也可 ...

  4. nbu oracle 冷备_NBU备份系统应用操作手册..doc

    NBU备份系统应用操作手册. NBU备份系统应用操作手册 2008.12.15编制 变更记录日期版本号描述作者2008-12-15v1.0根据NBU6.5备份服务器/客户机配置及运行情况分析整理的初稿 ...

  5. 橘子CPS联盟操作手册2021.09

    橘子CPS联盟操作手册2021.09 目录 橘子CPS联盟操作手册2021.09 橘子CPS联盟是干嘛的 橘子CPS基本操作流程 PC端操作 1.注册 2.登陆 3.渠道管理 4.分享网站 5.分享网 ...

  6. 橘子CPS联盟小程序操作手册2.0

    橘子CPS联盟小程序操作手册2.0 步骤1.申请小程序 2.橘子CPS联盟申请绑定小程序3.添加渠道活动4.发布小程序5.购买卡密 1.申请小程序 微信官方申请小程序 https://mp.weixi ...

  7. c++ 弹出菜单在固定的位置_固定资产管理软件操作手册(资产维修)

    资产维修:资产维修是针对固定资产的维修进行管理. 资产维修操作步骤如下(此处禁用审批流程): 1.新增资产维修信息 a.系统用户登录系统,点击"业务模块→日常管理→资产维修"菜单, ...

  8. 单一窗口关区备案_【干货】上海国际贸易单一窗口货物申报对接版(信天翁)“两段准入” 操作手册...

    上海国际贸易单一窗口货物申报对接版 (信天翁)"两段准入" 操作手册 什么是"两段准入"? 2019年10月16日,海关总署发布<关于分段实施准入监管 加 ...

  9. 视易精通收银服务器自动关机,视易精通量贩式收银系统操作-手册3.0.doc

    视易精通量贩式收银系统操作-手册3.0 ~ ~~~ 视易精通 收银管理系统 {用户操作手册} 目录 TOC \o "1-3" \h \u HYPERLINK \l _Toc2376 ...

最新文章

  1. Java项目:诚途旅游系统(java+JSP+Spring+SSM+Mysql)
  2. C primer plus 练习题 第三章
  3. 文件查找利器---find详解
  4. Andorid开发学习---ubuntu 12.04下搭建超好用的安卓模拟器genymotion 安装卸载virtualbox 4.3...
  5. sonarqube7.8汉化教程:安装中文插件
  6. Hibernate事务管理
  7. 【汇编】汇编学习入门-系列更新20180705
  8. Win10不能直接拖文件/Foxmail不能拖文件解决办法
  9. spring中redistemplate不能用通配符keys查出相应Key的问题
  10. OJDBC版本区别nbsp;[ojdbc14.jar…
  11. 【贪心】 大天使之剑
  12. python循环里使用len()与计算出len()后速度有区别吗
  13. 批处理 窗口最小化 java_如何让批处理程序启动的时候最小化
  14. 网站是如何变成灰色的
  15. Pandas|Index不是datatime index报错
  16. ur机器人编程学习-安全设置
  17. PHP开发实战权威指南-读书总结
  18. 二维数组转置以及矩阵乘法运算问题
  19. 精益创业之父Steve Blank: 如何让企业内部创新获得50倍增速
  20. Origin复制页面到word中出现:错误,嵌入对象无效

热门文章

  1. AVM环视拼接方法介绍
  2. 安卓java的提示错误怎么办_java – Android,如何从try的错误中显示一个对话框?...
  3. Python编程的一些实例(1)
  4. html页面内容分页【转】
  5. [转]嵌入式Web服务器
  6. 多项选择题标准化考试系统设计
  7. 单片机智能小区安防系统
  8. Apache虚拟主机示例
  9. 服务器响应404,无法加载资源错误:服务器响应状态为404(未找到)
  10. QQ自定义个人文件夹