当前位置:首页 > 日记 > 正文

Excel中表格工作表保护密码撤销的操作方法

Excel中表格工作表保护密码撤销的操作方法

  在做excel表格时我们有时候会给自己的工作表加密,一旦忘记密码就会很麻烦,如何绕过密码,直接撤销保护。今天,小编就教大家在Excel中表格工作表保护密码撤销的操作方法。

  Excel中表格工作表保护密码撤销的操作步骤

  打开excel,点击菜单栏的“视图”,点击二级菜单里的“宏”,选择录制宏。

表格工作表保护密码撤销的操作图1

  在弹出来的方框中输入宏的名称,点击确认。

表格工作表保护密码撤销的操作图2

  重复第一步的步骤,不过这次点击“停止录制”。

表格工作表保护密码撤销的操作图3

  选择查看宏。

表格工作表保护密码撤销的操作图4

  编辑宏。

表格工作表保护密码撤销的操作图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

猜你喜欢:

1.如何撤销excel工作表保护的方法

2.Excel表格取消密码保护的操作方法

3.怎么在excel中保护和取消保护工作表

4.excel表格取消密码保护的教程

5.excel表格撤销保护的方法

6.Excel中进行工作表设置密码保护的操作方法

7.Excel中2007版本进行撤销工作表保护密码的操作方法

8.Excel中进行表格工作表设置保护的操作方法

相关文章

jquery实现回车键触发事件 | 实例

jquery实现回车键触发事件 | 实例

回车键,事件,实例,电脑软件,jquery,键盘事件有3:keydown,keypress,keyup,分别是按下,按着没上抬,上抬键盘 。正确代码为:$(document).keyup(function(event){ if(event.keyCode ==13){ $("#submit").trigger("click"); }});推荐:keyup,防止笔记…

浅谈JavaScript find 方法不支持IE

浅谈JavaScript find 方法不支持IE

方法,不支持,浅谈,电脑软件,find,最近在前端开发中,遇到一个JavaScript 的问题。<script type="text/javascript"> var arrayList = new Array(); arrayList.push(1); arrayList.push(2); arrayList.push(3); arrayList.push(4); a…

怎样利用成熟的字体排版规则创造令

怎样利用成熟的字体排版规则创造令

字体,网页,创造,惊艳,成熟,漂亮的字体排版总能为网站设计加分不少。别具一格的设计虽然精彩,但是更多的时候,沿着前人探索出来的设计规则来设计,会更加得心应手。怎样利用成熟的规则来创造令人惊艳的网页呢?今天的文章就沿着这样的思路来探索网…

详解JavaScript按概率随机生成事件

详解JavaScript按概率随机生成事件

事件,概率,详解,电脑软件,JavaScript,最近做了一个JavaScript按概率随机生成事件,于是整理了一下思路,写了一个小demo:/**在抽奖的活动中经常会用到这个算法,不同奖项的获取概率不同,要按概率去随机生成对应的奖品**/function random(arr1, arr2…

详解——不让Tomcat重启

详解——不让Tomcat重启

重启,详解,电脑软件,Tomcat,要做到这样功能需要对本机有所配置一下:安装步骤:1、 在 windows 启动安装程序,在控制台输入 :java -jar dcevm-0.2-win.jar (路径放到dcevm-0.2-win.jar的文件夹)下面附件下载等一会儿,这时会出现一个程序框。选择一…

win10回收站自动清空

win10回收站自动清空

回收站,清空,电脑软件,回收站基本上是历代Windows桌面的必备摆设,它的作用就是防止用户误删除文件后没地儿哭去,属于&ldquo;后悔药&rdquo;&hellip;&hellip;不过对于某些&ldquo;系统洁癖&rdquo;用户来说,看回收站图标被一堆&ldquo;废纸&rdquo;…

jQuery is not defined 错误原因与

jQuery is not defined 错误原因与

解决方法,错误,原因,电脑软件,jQuery,通常出现这种状况有几种解决方法:1:查看是否引入jquery文件就算引入了文件了是不是通过一些整站下载器之类的软件下载的,都会出现问题,建议用迅雷到官方下载即可。2:查询路径是否错误,可以在页面源码中点…

Ai怎么制作一种文字镶嵌的效果?

Ai怎么制作一种文字镶嵌的效果?

文字,效果,电脑软件,Ai,平时使用AI软件来设计,若是直接写文字,有时候看起来就会显得很单调、乏味,若是能来点创意的设计,肯定能让人充满新鲜感,眼前一亮,比如把一张自己喜欢的,漂亮的图片填充嵌入到文字里面,又会是怎么样的感觉呢?让文字拥有了图片…

WPS文字中怎么给文章添加水印

WPS文字中怎么给文章添加水印

文字,水印,文章,电脑软件,WPS,  在文档中添加水印可以说是一种标志与象征,我们可以再很多文件中看到添加水印的形式,如&ldquo;机密文件&rdquo;、&ldquo;严禁复制&rdquo;等等,添加水印现在来说是一种趋势,更是一种&ldquo;维权&rdquo;的象征。…

Excel中出现循环引用警告的解决方

Excel中出现循环引用警告的解决方

循环引用,步骤,解决方法,电脑软件,Excel,  很多人在打开Excel的时候会频繁弹出&ldquo;循环引用警告&rdquo;这是怎么回事?是什么原因造成的?如何阻止弹出呢?今天,小编就教大家在Excel中出现循环引用警告的解决方法。Excel中出现循环引用警…

js的OOP继承实现 | 必看篇

js的OOP继承实现 | 必看篇

继承,必看,电脑软件,js,OOP,这里Student.prototype之所以使用create方法来创建,而不是直接赋Person.prototype的值,是因为如果使用赋值的话,两个就指向同一个对象,如果我们想要在student类上添加新的方法,就不行。所以要是哟呵那个create方法来…

使用Bootstrap打造特色进度条效果

使用Bootstrap打造特色进度条效果

进度条,特色,效果,电脑软件,Bootstrap,Bootstrap基本进度条实现1.外层容器使用class=progress类样式2.真正显示进度条样式的容器使用class=progress-bar类样式示例:<div class="progress"> <div class="progress-bar"></div> <!--可以…