Excel表格被保护不知道密码怎么解除(Excel表格如何撤销保护密码)

工作中,有时会出现这样的情况:用Excel编制的报表、表格、程序等,在单元格中设置了公式、函数等,为了防止其他人修改您的设置或者防止您自己无意中修改,您可能会使用Excel的工作表保护功能,

但时间久了保护密码容易忘记,有时从网上下载的Excel格式的小程序,想修改,但是作者加了工作表保护密码,

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

打开 2007版 Excel表格 按 快捷键 AIT F8 打开 "宏"

在宏名处填写一个名字(可随意),然后点击创建,弹出以下窗口

将窗口内的内容全选后删除

然后将下的内容开始复制粘贴在上面的窗口内:

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

关闭编辑窗口

按快捷键 AIT F8 点击执行后出弹出对话框,点击确定两次

等一会,就会出现以下对话框:

这就是Excel密码对应的原始密码

(此密码和原先设置的密码都能打开此文档。如果是别人的文档,你又想恢复密码设置,

就可以用此密码进行保护,他就能用他设置的密码打开,字母一定要大写)

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

(0)

相关推荐

  • pdf文档加密不知道密码怎么解除(pdf加密文件去除密码)

    电脑上的所有文档都是可以进行加密的,一旦加密之后,每次打开都是需要密码的.如果想要将密码去除掉,是需要通过相关软件来处理才可以实现.PDF文档是我们常用的文档格式之一,如果想要解除PDF的密码应该如何 ...

  • 如何解除excel中表格的数据验证

    电脑版Excel软件被很多人使用,用来编辑数据等,有的用户在输入数据时,因为输入了非法值或其他用户已限定,所以无法进行编辑,需要解除表格的数据验证,但是却不知道如何解除,那么小编就来为大家介绍一下吧. ...

  • Excel密码忘记:破解Excel密码

    Excel保护密码是用来防止别人修改Excel文档用的,但有时连自己都忘了,那该怎么办呢? 破解方法: 打开需要破解的excel文档,然后按Alt+F11打开VBA编辑器,点击插入-模块,在模块中将以 ...

  • QQ的保护模式多少天解除

    解除的天数是根据您进入保护模式的类型定的. 如果您进入的是永久类型,QQ号码存在重大违规和恶意操作,永久加入保护模式,那么将无法解除模式,建议申请新的QQ号码使用. 如果您进入的是申诉类型:QQ号码需 ...

  • 在Excel中如何快速绘制自己想要的表格?

    本例介绍如何快速在Excel中绘制出自己想要的表格样式,对于不知道怎么操作的朋友可以参考本文,希望能对大家有所帮助! 最终效果图: 1.首先,新建一个表格.点击[视图]选项卡,把[网格线]的复选框去掉 ...

  • 电脑Excel软件在有空单元格的多个表格中一键求和怎么操作

    有的小伙伴在电脑上使用Excel软件时,想要在有空单元格的多个表格进行一键求和操作,但是却不知道如何操作,那么小编就来为大家介绍一下吧.具体如下:1. 第一步,双击或者右击打开WPS软件.2. 第二步 ...

  • 笔记本电脑密码怎么解除(笔记本登陆密码忘了怎么办)

    小米笔记本原来加了开机启动密码,准备给小孩学习用,小孩嫌每次开机要输密码麻烦,按F2进BIOS清除密码,输入原密码,把新密码留空,F10保存重启,结果坏了,输什么密码都进不去,联系小米客服,很客气,让 ...

  • 忘记保护工作表密码怎样找回(表格加密忘记密码怎么办)

    昨天网友说EXCEL里的"撤消工作表保护"变为灰色了,帮其处理好后问题又来了,见下图:密码忘记了如何撤消工作表保护?一.显示扩展名1.我的电脑-----工具----文件夹选项2.查 ...

  • 如何解除WPS表格四舍五入功能

    WPS表格与EXCEL中的操作方法一致: 1.打开excel文件,输入几个数字,发现四舍五入了. 2.选中数字,右键-设置单元格格式. 3.在单元格格式中,点击常规,确定. 4.发现数字正常显示了. ...

  • excel票据套打模板(用Excel2003套打表格)

    如何用Excel2003套打表格? 通常套打表格都用Word.WPS来实现,但由于Word.WPS软件本身的计算功能有限,有时很难满足数据极多.计算量也较大的财会.税务和统计等行业报表的需求. 对于此 ...