1. 首页 > excel教程

exelce表格保护后忘了密码(excel表设置了保护密码忘了怎么解)

exelce表格保护后忘了密码(excel表设置了保护密码忘了怎么解)

本文主要为大家介绍excel表格保护后忘记密码(excel表格设置了密码保护怎么解决),下面一起来看看具体内容吧。

Excel密码破解步骤如下:

打开受密码保护的工作表

工具---宏---录制新宏---输入名称如:hh

停止录制(这样你会得到一个空的宏)

Tools---Macro---Macro,选择hh,点击编辑按钮

删除窗口中的所有字符,替换为以下内容:

公共子AllInternalPasswords()

' 打破工作表和工作簿结构密码。鲍勃麦考密克

'可能是为覆盖而修改的基本代码算法的发起者

' 工作簿结构/Windows 密码和多个密码

'

' Norman Harker 和JE McGimpsey 2002 年12 月27 日(1.1 版)

' 由JEM: 于2003 年4 月4 日修改所有消息为常量,并且

' 消除一个Exit Sub(版本1.1.1)

'显示散列密码而不是原始密码

Const DBLSPACE 作为字符串=vbNewLine vbNewLine

Const AUTHORS 作为字符串=DBLSPACE vbNewLine_

'改编自Bob McCormick 基本代码' _

“诺曼哈克和JE McGimpsey”

Const HEADER As String='所有内部密码用户消息'

Const VERSION As String=DBLSPACE '版本1.1.1 2003-Apr-04'

Const REPBACK As String=DBLSPACE '请报告失败'_

“到microsoft.public.excel.programming 新闻组。”

Const ALLCLEAR As String=DBLSPACE '工作簿应该'_

'现在不受所有密码保护,所以确保你:'_

DBLSPACE '立即保存! DBLSPACE '还有' _

DBLSPACE '备份!备份!备份!'_

DBLSPACE '此外,请记住密码是'_

'放在那里是有原因的。不要塞满关键的公式'_

“或数据。” DBLSPACE '访问和使用某些数据' _

'可能是一种冒犯。如果有疑问,不要。

Const MSGNOPWORDS1 As String='There were no passwords on ' _

“工作表、工作簿结构或窗口。”作者版本

Const MSGNOPWORDS2 As String='没有保护' _

'工作台

ok 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

  关闭编辑窗口 ,工具---宏-----运行,等1分钟,再确定.OK,没有密码了

关于excel表格保护后忘记密码(excel表格设置了密码保护怎么解决)的介绍到这里就结束了,了解更多办公软件知识可以收藏我们的网站,我们将为你提供更多精彩内容。

本文由许宝财发布,不代表东辰网立场,转载联系作者并注明出处:https://www.ktwxcd.com/excel/250167.html

留言与评论(共有 0 条评论)
   
验证码:

联系我们

在线咨询:点击这里给我发消息

微信号:vx614326601

工作日:9:30-18:30,节假日休息