Excel表格保护密码忘了解决办法_Excel表格保护密码

电脑维修 2023-07-18 07:07www.caominkang.com电脑维修知识

  excel密码破解步骤如下

  打开受密码保护的工作表

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

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

  工具---宏----宏,选hh,点编辑按钮

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

  Public Sub AllInternalPassords()

  ' Breaks orksheet and orkbook structure passords. Bob McCormick

  ' probably originator of base code algorithm modified for coverage

  ' of orkbook structure / indos passords and for multiple passords

  '

  ' 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 passords NOT original passords

  Const DBLSPACE As String = vbNeLine & vbNeLine

  Const AUTHORS As String = DBLSPACE & vbNeLine & _

  "Adapted from Bob McCormick base code by" & _

  "Norman Harker and JE McGimpsey"

  Const HEADER As String = "AllInternalPassords 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 nesgroup."

  Const ALLCLEAR As String = DBLSPACE & "The orkbook should " & _

  "no be free of all passord protection, so make sure you:" & _

  DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _

  DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _

  DBLSPACE & "Also, remember that the passord as " & _

  "put there for a reason. Don't stuff up crucial formulas " & _

  "or data." & DBLSPACE & "Aess and use of some data " & _

  "may be an offense. If in doubt, don't."

  Const MSGNOPWORDS1 As String = "There ere no passords on " & _

  "sheets, or orkbook structure or indos." & AUTHORS & VERSION

  Const MSGNOPWORDS2 As String = "There as no protection to " & _

  "orkbook structure or indos." & DBLSPACE & _

  "Proceeding to unprotect sheets." & AUTHORS & VERSION

  Const MSGTAKETIME As String = "After pressing OK button this " & _

  "ill take some time." & DBLSPACE & "Amount of time " & _

  "depends on ho many different passords, the " & _

  "passords, and your puter's specification." & DBLSPACE & _

  "Just be patient! Make me a coffee!" & AUTHORS & VERSION

  Const MSGPWORDFOUND1 As String = "You had a Worksheet " & _

  "Structure or Windos Passord set." & DBLSPACE & _

  "The passord found as: " & DBLSPACE & "" & DBLSPACE & _

  "Note it don for potential future use in other orkbooks by " & _

  "the same person ho set this passord." & DBLSPACE & _

  "No to check and clear other passords." & AUTHORS & VERSION

  Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _

  "passord set." & DBLSPACE & "The passord found as: " & _

  DBLSPACE & "" & DBLSPACE & "Note it don for potential " & _

  "future use in other orkbooks by same person ho " & _

  "set this passord." & DBLSPACE & "No to check and clear " & _

  "other passords." & AUTHORS & VERSION

  Const MSGONLYONE As String = "Only structure / indos " & _

  "protected ith the passord that as just found." & _

  ALLCLEAR & AUTHORS & VERSION & REPBACK

  Dim 1 As Worksheet, 2 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 .ProtectWindos

  End With

  ShTag = False

  For Each 1 In Worksheets

  ShTag = ShTag Or 1.ProtectContents

  Next 1

  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 _

  .ProtectWindos = 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 1 In Worksheets

  'Attempt clearance ith PWord1

  1.Unprotect PWord1

  Next 1

  On Error GoTo 0

  ShTag = False

  For Each 1 In Worksheets

  'Checks for all clear ShTag triggered to 1 if not.

  ShTag = ShTag Or 1.ProtectContents

  Next 1

  If ShTag Then

  For Each 1 In Worksheets

  With 1

  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 Pord by trying on other sheets

  For Each 2 In Worksheets

  2.Unprotect PWord1

  Next 2

  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 1

  End If

  MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER

  End Sub

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

Copyright © 2016-2025 www.caominkang.com 曹敏电脑维修网 版权所有 Power by