第一篇:刪除EXCEL工作表密碼的宏代碼
Public Sub 刪除工作表密碼()
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
第二篇:撤銷(xiāo)工作表保護(hù)密碼
撤銷(xiāo)工作表保護(hù)密碼”的破解并獲取原始密碼
在日常工作中,您是否遇到過(guò)這樣的情況:您用Excel編制的報(bào)表、表格、程序等,在單元格中設(shè)置了公式、函數(shù)等,為了防止其他人修改您的設(shè)置或者防止您自己無(wú)意中修改,您可能會(huì)使用Excel的工作表保護(hù)功能,但時(shí)間久了保護(hù)密碼容易忘記,這該怎么辦?有時(shí)您從網(wǎng)上下載的Excel格式的小程序,您想修改,但是作者加了工作表保護(hù)密碼,怎么辦?您只要按照以下步驟操作,Excel工作表保護(hù)密碼瞬間即破!
1、打開(kāi)您需要破解保護(hù)密碼的Excel文件;
2、依次點(diǎn)擊菜單欄上的工具---宏----錄制新宏,輸入宏名字如:aa;
3、停止錄制(這樣得到一個(gè)空宏);
4、依次點(diǎn)擊菜單欄上的工具---宏----宏,選aa,點(diǎn)編輯按鈕;
5、刪除窗口中的所有字符(只有幾個(gè)),替換為下面的內(nèi)容;
從橫線下開(kāi)始復(fù)制
----------------------------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---------------------------復(fù)制到橫線以上
6、關(guān)閉編輯窗口;
7、依次點(diǎn)擊菜單欄上的工具---宏-----宏,選AllInternalPasswords,運(yùn)行,確定兩次;
等一會(huì),就會(huì)出現(xiàn)以下對(duì)話框:這就是Excel密碼對(duì)應(yīng)的原始密碼(此密碼和原先設(shè)置的密碼都能打開(kāi)此文檔。如果是別人的文檔,你又想恢復(fù)密碼設(shè)置,就可以用此密碼進(jìn)行保護(hù),他就能用他設(shè)置的密碼打開(kāi),你可以試試,很有趣的。字母一定要大寫(xiě)):
第三篇:Excel 2007中添加或刪除工作表背景
Excel 2007中添加或刪除工作表背景
2007-09-27 10:07作者:編輯整理出處:天極網(wǎng)軟件頻道責(zé)任編輯:still
Excel 2007中,您可以將圖片用作僅供顯示的工作表背景。工作表背景不會(huì)被打印,也不會(huì)保留在單個(gè)工作表中或保留在另存為網(wǎng)頁(yè)的項(xiàng)目中。(Office2007專(zhuān)區(qū))
要點(diǎn) 由于不會(huì)打印工作表背景,因此不能將其用作水印。但是,通過(guò)在頁(yè)眉或頁(yè)腳中插入圖形,您可以創(chuàng)造出水印的效果。
添加工作表背景
1、單擊要為其顯示工作表背景的工作表。請(qǐng)確保只選中了一個(gè)工作表。
2、在“頁(yè)面布局”選項(xiàng)卡上的“頁(yè)面設(shè)置”組中,單擊“背景”。
3、選擇要用作工作表背景的圖片,然后單擊“插入”。
所選圖片將重復(fù)填入工作表中。
注釋
·為了提高可讀性,您可以隱藏單元格網(wǎng)格線,并將單色陰影應(yīng)用于包含數(shù)據(jù)的單元格。·當(dāng)您保存工作簿時(shí),工作表背景將與工作表數(shù)據(jù)一起保存。
刪除工作表背景
1、單擊為其顯示工作表背景的工作表。請(qǐng)確保只選中了一個(gè)工作表。
2、在“頁(yè)面布局”選項(xiàng)卡上的“頁(yè)面設(shè)置”組中,單擊“背景”。
在 Excel 中創(chuàng)造水印效果
在 Excel 中無(wú)法使用水印功能。如果要在每張打印的頁(yè)面上顯示圖形(例如,用于指明信息屬于機(jī)密信息),您可以在頁(yè)眉或頁(yè)腳中插入圖形。這樣,圖形將從每頁(yè)的頂部或底部開(kāi)始顯示在文本背后。您也可以調(diào)整圖形大小或縮放圖形以填充頁(yè)面。
1、單擊要與水印一起顯示的工作表。請(qǐng)確保只選中了一個(gè)工作表。
2、在“插入”選項(xiàng)卡上的“文本”組中,單擊“頁(yè)眉和頁(yè)腳”。
3、在“頁(yè)眉”下,單擊“左”、“中”或“右”框。
4、在“頁(yè)眉和頁(yè)腳元素”組中的“頁(yè)眉和頁(yè)腳工具”的“設(shè)計(jì)”選項(xiàng)卡上,單擊“圖片”后查找要插入的圖形。,然
5、雙擊圖形將其插入頁(yè)眉區(qū)域框中。
6、要調(diào)整圖形大小或縮放圖形,請(qǐng)單擊“頁(yè)眉和頁(yè)腳元素”組中的“設(shè)置圖片格式”然后在“設(shè)置圖片格式”對(duì)話框中的“大小”選項(xiàng)卡上選擇所需選項(xiàng)。
注釋
·對(duì)圖形或圖形格式所做的更改將會(huì)立即生效,并且不能撤消。
·如果要在圖形上面或下面增加空間,請(qǐng)?jiān)凇?[圖片]”之前或之后單擊,然后按 Enter 開(kāi)始新的一行。
·要更換圖形,請(qǐng)?jiān)凇绊?yè)眉和頁(yè)角元素”組中選擇“&[圖片]”,單擊“圖片”
換”。
·在打印之前,請(qǐng)確保頁(yè)眉或頁(yè)腳邊緣留有足夠的空間可用于自定義的頁(yè)眉或頁(yè)腳?!ひ?jiǎng)h除圖形,請(qǐng)選擇“&[圖片]”,然后按 Delete。,然后單擊“替,
第四篇:破解EXCEL工作表保護(hù)密碼的簡(jiǎn)單方法
破解EXCEL工作表保護(hù)密碼的簡(jiǎn)單方法
你是否給excel文件設(shè)置了保護(hù)工作表密碼,現(xiàn)在要撤消工作表保護(hù),但密碼卻忘了,自己把鎖在了門(mén)外,真尷尬呀!怎么辦?下面的方法將輕松解決: 本人親測(cè),完全可以成功,但是本方法只用于解決自己的文件忘記密碼,請(qǐng)勿進(jìn)行違法行為,一切后果本人不負(fù)責(zé)任
1.打開(kāi)你的受保護(hù)的文件
2.工具---宏----錄制新宏---輸入名字如:aa
3.停止錄制(這樣得到一個(gè)空宏)
4.工具---宏----宏,選aa,點(diǎn)編輯按鈕
5.刪除窗口中的所有字符,替換為下面的內(nèi)容:(復(fù)制吧)
6.關(guān)閉編輯窗口
7.工具---宏-----宏,選AllInternalPasswords,運(yùn)行,確定兩次,等2分鐘,再確定.OK,沒(méi)有密碼了!
內(nèi)容如下:
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)
MsgBoxApplication.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
IfWinTag 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)
MsgBoxApplication.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
第五篇:Excel 2007中忘記保護(hù)工作表密碼的解決方法
Excel 2007中忘記保護(hù)工作表密碼的解決
作為一名該亞中國(guó)的網(wǎng)站編輯,我有責(zé)任向大家推薦一種Excel中忘記保護(hù)密碼的解決辦法,有了這個(gè)辦法,也許能在你的工作中省去很多煩惱。
一個(gè)最近比較杯具的客戶今天又出了一個(gè)比較杯具的問(wèn)題,為了防止別人修改他的表格,在Excel中設(shè)置了保護(hù)工作表,之后又戲劇性地忘記了,求解決方案。
值得慶幸的是他使用了Office 2007,眾所周知Office 2007的全新文檔類(lèi)型是基于XML的,所有的docx、xlsx、pptx等都是標(biāo)準(zhǔn)的zip文件;針對(duì)上面這個(gè)問(wèn)題,可以采用如下方式解決:
1.將設(shè)置保護(hù)工作表密碼的xlsx擴(kuò)展名更改為zip。
2.直接在7z或者RAR中雙擊打開(kāi),找到xlworksheets文件夾下,找到設(shè)置保護(hù)工作表的工作表名,如Sheet1.3.將該XML文件單獨(dú)解壓,使用記事本打開(kāi),Ctrl+F找到"SheetProtection”字段,將
4.4.將保存后的XML添加到zip文件原始位置。
5.將ZIP文件改回xlsx,即可去除設(shè)置密碼的工作表保護(hù)。
6.當(dāng)你看了前面5點(diǎn),應(yīng)該已經(jīng)豁然開(kāi)朗,那趕快關(guān)注一下我們?cè)搧喼袊?guó)吧,在這里,能讓你只用鼠標(biāo),就暢游本地,