EXCEL工作表编辑资料,设置了工作表保护后,不能对表格进行插入删除操作。如果没有密码,很简单:工具-选项—工作表保护——撤消工作表保护 就可以了。如果忘记密码,使用如下excel密码破解操作: 字串9
1\打开文件 字串2
2\工具---宏----录制新宏---输入名字如:a
3\停止录制(这样得到一个空宏)
4\工具---宏----宏,选a,点编辑按钮
字串7
5\删除窗口中的所有字符(只有几个),替换为下面的内容:(复制下来) 字串3
Option Explicit
字串4
Public Sub AllInternalPasswords() 字串6
' Breaks worksheet and workbook structure passwords. Bob McCormick 字串8
' probably originator of base code algorithm modified for coverage
' of workbook structure / windows passwords and for multiple passwords 字串8
' 字串4
' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1) 字串2
' Modified 2003-Apr-04 by JEM: All msgs to constants, and
' eliminate one Exit Sub (Version 1.1.1) 字串9
' Reveals hashed passwords NOT original passwords
字串4
Const DBLSPACE As String = vbNewLine & vbNewLine
Const AUTHORS As String = DBLSPACE & vbNewLine & _
字串5
"Adapted from Bob McCormick base code by" & _ 字串2
"Norman Harker and JE McGimpsey"
字串3
Const HEADER As String = "AllInternalPasswords User Message" 字串3
Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04" 字串3
Const REPBACK As String = DBLSPACE & "Please report failure " & _
字串2
"to the microsoft.public.excel.programming newsgroup."
字串1
Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _ 字串5
"now be free of all password protection, so make sure you:" & _ 字串7
DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _ 字串9
DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _ 字串8
DBLSPACE & "Also, remember that the password was " & _
字串6
"put there for a reason. Don't stuff up crucial formulas " & _
字串7
"or data." & DBLSPACE & "Access and use of some data " & _ 字串4
"may be an offense. If in doubt, don't."
Const MSGNOPWORDS1 As String = "There were no passwords on " & _ 字串1
"sheets, or workbook structure or windows." & AUTHORS & VERSION
字串4
Const MSGNOPWORDS2 As String = "There was no protection to " & _ 字串2
"workbook structure or windows." & DBLSPACE & _ 字串1
"Proceeding to unprotect sheets." & AUTHORS & VERSION
Const MSGTAKETIME As String = "After pressing OK button this " & _ 字串9
"will take some time." & DBLSPACE & "Amount of time " & _ 字串9
"depends on how many different passwords, the " & _ 字串2
"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 & _ 字串2
"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 字串7
Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _
"password set." & DBLSPACE & "The password found was: " & _
字串4
DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _ 字串3
"future use in other workbooks by same person who " & _ 字串5
"set this password." & DBLSPACE & "Now to check and clear " & _
"other passwords." & AUTHORS & VERSION 字串5
Const MSGONLYONE As String = "Only structure / windows " & _ 字串3
"protected with the password that was just found." & _
字串9
ALLCLEAR & AUTHORS & VERSION & REPBACK 字串8
Dim w1 As Worksheet, w2 As Worksheet 字串3
Dim i As Integer, j As Integer, k As Integer, l As Integer 字串6
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
字串4
Dim PWord1 As String
字串1
Dim ShTag As Boolean, WinTag As Boolean 字串1
Application.ScreenUpdating = False 字串6
With ActiveWorkbook
WinTag = .ProtectStructure Or .ProtectWindows
字串1
End With 字串5
ShTag = False
For Each w1 In Worksheets 字串7
ShTag = ShTag Or w1.ProtectContents
Next w1
字串1
If Not ShTag And Not WinTag Then
MsgBox MSGNOPWORDS1, vbInformation, HEADER
Exit Sub
字串6
End If 字串7
MsgBox MSGTAKETIME, vbInformation, HEADER 字串4
If Not WinTag Then
MsgBox MSGNOPWORDS2, vbInformation, HEADER 字串8
Else 字串6
On Error Resume Next 字串1
Do 'dummy do loop 字串8
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 字串1
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 字串5
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 字串4
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 字串4
With ActiveWorkbook
.Unprotect Chr(i) & Chr(j) & Chr(k) & _
字串3
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
字串4
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
字串4
If .ProtectStructure = False And _ 字串7
.ProtectWindows = False Then 字串1
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ 字串1
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ 字串6
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
字串7
MsgBox Application.Substitute(MSGPWORDFOUND1, _ 字串4
"$$", PWord1), vbInformation, HEADER 字串2
Exit Do 'Bypass all for...nexts 字串6
End If 字串3
End With 字串6
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next 字串4
Loop Until True 字串5
On Error GoTo 0
字串6
End If
字串5
If WinTag And Not ShTag Then
字串3
MsgBox MSGONLYONE, vbInformation, HEADER
字串7
Exit Sub
End If
On Error Resume Next
字串5
For Each w1 In Worksheets
'Attempt clearance with PWord1 字串5
w1.Unprotect PWord1 字串9
Next w1
On Error GoTo 0 字串1
ShTag = False 字串2
For Each w1 In Worksheets
字串1
'Checks for all clear ShTag triggered to 1 if not.
字串4
ShTag = ShTag Or w1.ProtectContents
Next w1
字串8
If ShTag Then 字串3
For Each w1 In Worksheets
字串5
With w1
If .ProtectContents Then 字串1
On Error Resume Next
Do 'Dummy do loop 字串6
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 字串1
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 字串7
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 字串5
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
.Unprotect Chr(i) & Chr(j) & Chr(k) & _
字串6
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ 字串1
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
字串4
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, _ 字串9
"$$", PWord1), vbInformation, HEADER 字串7
'leverage finding Pword by trying on other sheets 字串7
For Each w2 In Worksheets
w2.Unprotect PWord1 字串6
Next w2
字串2
Exit Do 'Bypass all for...nexts
End If
字串7
Next: Next: Next: Next: Next: Next 字串9
Next: Next: Next: Next: Next: Next 字串7
Loop Until True 字串9
On Error GoTo 0
字串8
End If
字串3
End With 字串5
Next w1 字串5
End If 字串9
MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER
字串4
End Sub
字串6
6\关闭编辑窗口 字串5
7\工具---宏-----宏,选AllInternalPasswords,运行,确定两次,等2分钟(确实有这么长时间),再确定.
OK,没有密码了!!