如何撤销工作表保护

 

1、打开文件

2、工具-->宏-->录制新宏-->输入名字如:aa

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

4、工具-->宏-->宏,选aa,点编辑按钮

5、删除窗口中的所有字符(只有几个),替换为下面的内容:(复制吧)

6、关闭编辑窗口

7、工具-->宏-->宏,选AllInternalPasswords,运行,确定两次,等2分钟,再确定.OK,没有密码了!!

代码如下:

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

EXCEL中如何撤销工作表保护相关推荐

  1. Excel撤销工作表保护方法(Excel无法调节列宽解决办法)

    Excel撤销工作表保护方法 前言 1.Excel工作表保护表现 2.忘记密码如何清除Excel的密码保护 1.第一步:录制宏 2.第二步:结束宏 3.第三步:编辑宏脚本 4.运行结果 前言 在某工作 ...

  2. EXCEL密码破解/破解工作表保护密码(详细图文教程)

    EXCEL密码破解/破解工作表保护密码(详细图文教程) 网上有很多这个代码,但很多朋友并不太了解如何运用在此做了一些整理,希望对大家有所帮助! 注:很多时候会因为忘记密码丢失重要EXCEL文件而烦恼, ...

  3. 将excel中的一个工作表按照某列拆分成多个sheet工作表

    如何将excel中的一个工作表按照某列拆分成多个sheet工作表呢?接下来就利用VBA工具来解决这个问题. 拆分之前的工作表: 拆分之后的工作表: 操作步骤具体如下: 第一步:打开需要拆分的表格文件: ...

  4. excel撤销工作表保护默认密码_我的表格我做主:Excel工作表不想被别人改动,设置一个密码保护...

    工作中,一个Excel表格需要多人填充数据时.或者发给同事的表格只允许查看时,不想表格回来时已面目全非. 今天小编教你设置工作表保护密码,不需要再三叮嘱,只允许查看表格数据的整体设置保护,需要多人填充 ...

  5. EXCEL工程加密及工作表保护密码破解方法

    1.EXCEL工程加密破解方法 新建一个EXCEL文档 打开新建的这个Excel,按下alt+F11,打开vb界面,新建一个模块,如图所示 将代码复制到这个模块中,代码如下: Private Sub ...

  6. C#实战021:OleDb操作-新增Excel中的sheet工作表

    获取到lExcel中的sheet中的所有工作表,我们就可以来创建新的sheet工作表了,首先我们判断下Excel中的sheet中的所有工作表中是否存在我们需要创建的sheet工作表,如果没有的话我们在 ...

  7. EXCEL中如何获得工作表(sheet)的名称

    excel 取得工作表名 方法一 常规方法 cell函数 也可以这样取得工作表名,在任一单元格输入: =RIGHT(CELL("filename"),LEN(CELL(" ...

  8. 列注释_【EXCEL检查问题】:如何快速检查并删除EXCEL中隐藏的工作表、行、列等信息...

    前注:本案例是以EXCEL2016为示范软件,各版本的部分功能和路径可能不同 在EXCEL使用过程中,你是否遇到过某一列的公式怎么修改都报错的情况?你是否遇到过一个只有区区几行数据的表格,却占用了好几 ...

  9. vba工作表重命名_如何在Excel中重命名工作表选项卡

    vba工作表重命名 By default, worksheet tabs in Excel are given generic names, such as Sheet1, Sheet2, and s ...

  10. 如何在Excel中批量新建工作表

    任务需求: 按照月份时间生成单月工作表,生成结果如下图所示: 下面是具体的生成步骤,本文使用的是2016版Excel. 步骤一: 准备数据.在A1单元格设置类标签,在A2单元格输入2019年1月,然后 ...

最新文章

  1. 微软职位内部推荐-Senior Software Engineer_Azure
  2. winform 消息通讯组件实习
  3. Excel快速改变行列的次序
  4. ★36句经典英文格言
  5. 牛客网刷题 --- 输入输出数据处理
  6. order by 子查询_SQL查询语法
  7. 文件服务器 ip,共享文件服务器的ip地址
  8. DevExpress Dashboard创建仪表盘参数
  9. 《Android游戏编程之从零开始》笔记
  10. 基于java的病历管理系统设计与实现
  11. 数学建模之预测方法总结与案例
  12. 【暂时完结】Prescan学习笔记
  13. 修改android设备型号
  14. 一体化伺服电机与施耐德PLC TM241CEC24T在Canopen协议下的应用
  15. Samba服务------SMB协议
  16. 照片怎么转换成pdf?
  17. 微信开发工具tabBar中的list 图片为啥加载不出来?
  18. python中keys的用法_在Python中用keys()方法返回字典键的教程
  19. C标准库头文件—ctype.h
  20. [csh]配置你的csh/tcsh

热门文章

  1. Appium原理总结
  2. 字体角度css代码,CSS中font-style定义字体倾斜体样式的代码示例
  3. Android屏幕、坐标系、Padding、Margin
  4. LTE中QPSK、16QAM、64QAM什么意思?有什么区别,分别在什么情况下占用呢?
  5. 顺序表的基本操作实现
  6. a标签下载文件 自定义下载文件名
  7. CSS3实现八方向云台控制器器样式
  8. 如何从网页上下载页面嵌入的PDF文件
  9. matlab2012a for mac,matlab 2016a mac |matlab 2016a for mac免费版专业版 32位/64位 - 系统天堂...
  10. 企业管理系统有几种类型,分别是什么?