當(dāng)前位置:首頁文章首頁 新聞中心

Excel—“撤銷工作表保護(hù)密碼”的破解并獲取原始密碼

作者:  來源:  發(fā)布時(shí)間:2011-9-10 17:11:37  點(diǎn)擊:

Excel—“撤銷工作表保護(hù)密碼”的破解并獲取原始密碼

在日常工作中,您是否遇到過這樣的情況:您用Excel編制的報(bào)表、表格、程序等,在單元格中設(shè)置了公式、函數(shù)等,為了防止其他人修改您的設(shè)置或者防止您自己無意中修改,您可能會(huì)使用Excel的工作表保護(hù)功能,但時(shí)間久了保護(hù)密碼容易忘記,這該怎么辦?有時(shí)您從網(wǎng)上下載的Excel格式的小程序,您想修改,但是作者加了工作表保護(hù)密碼,怎么辦?您只要按照以下步驟操作,Excel工作表保護(hù)密碼瞬間即破!

1、打開您需要破解保護(hù)密碼的Excel文件;

2、依次點(diǎn)擊菜單欄上的工具---宏----錄制新宏,輸入宏名字如:aa;

3、停止錄制(這樣得到一個(gè)空宏);

4、依次點(diǎn)擊菜單欄上的工具---宏----宏,選aa,點(diǎn)編輯按鈕;

5、刪除窗口中的所有字符(只有幾個(gè)),替換為下面的內(nè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

文章評(píng)論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z