当前位置:首页 > 实用技巧 >

怎么解除工作表保护密码(工作表被保护怎么解除密码)

来源:原点资讯(m.360kss.com)时间:2023-10-31 12:36:21作者:YD166手机阅读>>

方法:

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

此方法,本人亲自试过,确实不错

感谢写出这段编码的同志

,

栏目热文

工作表保护密码初始密码是多少(保护工作表密码忘记了)

工作表保护密码初始密码是多少(保护工作表密码忘记了)

为了防止工作表被意外修改,可以设置工作表保护密码。Worksheet对象的Protect方法有很多可选参数,其中Pass...

2023-10-31 12:35:50查看全文 >>

工作表保护的密码是从哪里来的(工作表受保护不知道密码怎么解除)

工作表保护的密码是从哪里来的(工作表受保护不知道密码怎么解除)

如何快速保护工作表,防止他人修改数据呢?今天来解答一个学生的问题。打开文件后,我们可以随意设置其中的内容。要想保护工作表...

2023-10-31 13:07:03查看全文 >>

受保护工作表没有密码怎么修改(没有密码怎么撤销工作表保护)

受保护工作表没有密码怎么修改(没有密码怎么撤销工作表保护)

如何保护自己的表格不被别人修改。在工作中把表格发给同事,他们填入信息之后表格有些信息总会被改变,而且还是乱七八糟的,然后...

2023-10-31 12:56:46查看全文 >>

撤销工作表保护的密码是什么密码(工作表保护密码怎么撤销或解密)

撤销工作表保护的密码是什么密码(工作表保护密码怎么撤销或解密)

第一步:在 “杭州” 中,①单击 “审阅” 选项卡,②在 “更改” 功能组中单击 “保护工作表” 按钮。第二步:弹出 “...

2023-10-31 12:50:57查看全文 >>

取消工作表保护密码(怎么取消工作表保护密码)

取消工作表保护密码(怎么取消工作表保护密码)

在线Excel表格解密找回密码,简单易操作一步搞定如果你遇到了Excel表格密码忘记或忘记的问题,不要慌张!下面给大家介...

2023-10-31 13:17:27查看全文 >>

如何为工作表设置保护密码(如何去除工作表保护密码)

如何为工作表设置保护密码(如何去除工作表保护密码)

本文于2023年6月28日首发于本人同名公众号:Excel活学活用,更多文章案例请搜索关注!☆本期内容概要☆保护工作表锁...

2023-10-31 13:02:03查看全文 >>

如何将相机加入分屏里(怎样使相机和相册支持分屏)

如何将相机加入分屏里(怎样使相机和相册支持分屏)

我们在录制视频的时候,会有将电脑屏幕和摄像头同时录制的情况,那么遇到这种情况了,该如何实现呢?今天就和小编一起来学学以下...

2023-10-31 12:33:12查看全文 >>

手机拍照怎么分屏(手机分屏拍摄教程)

手机拍照怎么分屏(手机分屏拍摄教程)

分屏技术是一种将屏幕分成多个显示区域的技术!通常将视频画面分成三个区域,丰富视频的视觉效果,让观众感受到更强的视觉冲击力...

2023-10-31 13:14:38查看全文 >>

相机怎么和别的软件分屏用(怎样使相机和相册支持分屏)

相机怎么和别的软件分屏用(怎样使相机和相册支持分屏)

【环球网科技综合报道】据印度英文新闻网站“今日印度”1月29日报道,OPPO最近为其独创的设计申请专利——将智能手机的前...

2023-10-31 12:49:07查看全文 >>

手机的照相机怎么分屏(手机照相怎样分屏)

手机的照相机怎么分屏(手机照相怎样分屏)

如今手机相机技术可谓愈发成熟,大底传感器、防抖技术、变焦技术等应用给手机带来了十分丰富的玩法,适合更多的使用场景。但现在...

2023-10-31 13:03:50查看全文 >>

文档排行