管理资源吧

当前位置:管理资源吧首页>>>tech>>>c1>>>Excel教程

使excel表格内容只读不能修改及破解

  只读不能修改方法:

  在EXCEL里,选择工具——选项——安全性——分别设置打开权限密码和修改权限密码,2个密码要不一样,然后确定,会弹出对话框让你重新输入密 码,第一个框输入你设置打开权限密码,第二个框输入你修改权限密码,然后保存文件。然后你把打开权限密码给别人就OK了,别人打开就是只读,不能修改。要 修改需要你修改权限密码。

  补充一下:如果不想只读打开需要密码,可以不设置打开权限密码,只设置修改权限密码。

  破解Excel保护方法

  Excel对数据有很强的保护功能,可以对整个或部分数据隐藏、禁止复制和修改等,但有时候,由于忘记了密码,或者记不起以前自己到底做了哪些改动,这种保护反而会为难自己。针对这种情况,我总结了几种解除保护的方法,供大家参考,并希望能够以此抛砖引玉。

  一、解除单元格的保护

  1.取消隐藏的行或列

  被隐藏的行或列有一个明显的标志,那就是在行标题栏或列标题栏上有一条粗的黑线。取消隐藏的行或列的方法有两种,一种是直接拖动隐藏处的行或列标题使之变 宽,也可以选中包含隐藏区域的行或列,通过“格式”菜单中的行列项目输入非0数值调整行高或列宽,使数据有足够的空间显示出来;另一种方法是选中包含隐藏 内容的行或列区域,再通过“格式”菜单行列选项中的“取消隐藏”命令来恢复全部行列区域。

  2.取消隐藏单元格或区域中的数据

  为了不让他人直接看到单元格的内容,一种简单的方法就是把数据颜色设置成与背景色相同,这时我们只要拖选整个工作表即可让数据原形毕露;如果用图片、矩形 框之类的非字符内容将重要数据遮盖,需要先用拖选方式找出工作表中的图片位置,再将其移开,激活被遮住的单元格,一般在公式编辑栏中就会显示其内容。

  若在单元格格式中使用了三个分号或空格之类的自定义格式,一般只要选中此单元格,在公式编辑栏中即可显示其内容,要想取消这种隐藏,可重新设置此单元格格式,在“数字”选项卡中选择“常规”即可。

  如果选中怀疑有数据的单元格后并没有在公式编辑栏中显示数据,不一定它就真的没有数据,我们只要看一下单元格的格式能否设置,若不能的话说明工作表被保 护,如果不用密码可以取消工作表保护的话,再在单元格格式设置中先查看数据格式是否为自定义,然后查看“保护”选项卡,看看是否已勾选了“隐藏”项,将这 些都取消就可以知道单元格是否真的没有内容。当然,如果在撤消工作表保护时需要密码的话,我们将无可奈何,除非用户设置的密码很简单,那我就告诉你一个秘 密,当密码的形式是“*123*”或“*abc*”时,我们可以分别用“*333*”或“*ccc*”来破解,星号表示任意字符,到底是什么只有靠猜了, 这种方法对工作表和工作簿保护的密码也适应。

  3.取消单元格数据的只读属性

  有时单元格中的数据虽然可见,但是我们既不能修改,也不能在当前工作表中复制,对于这种保护措施,取消的方法跟上面的第2点基本相同,只要取消单元格格式 设置对话框中“保护”选项卡中的“锁定”一项即可。当然还需要通过密码取消工作表的保护才行。

  如果我们无法通过密码取消怎么办?你可以将其复制粘贴到其他工作表中,再在新的工作表中进行修改。

  二、解除工作表的保护

  查看是否有被隐藏的工作表,若菜单中有“格式→工作表→取消隐藏”项,则可通过此项取消隐藏的工作表。

  如果在菜单中也没有有效的“取消隐藏”项,仍然可能有被隐藏的工作表,这时我们可以任选一工作表右击,在弹出菜单中选择“查看代码”,然后在左窗格中的 “Microsoft Excel 对象”列表中选择被隐藏的工作表,将其“Visible”属性值取“-1”退出即可,如图所示。

[Ok3w_NextPage]

  如果工作表被密码保护,则可复制当前表全部内容到另一张未保护的工作表中编辑。

  三、VBA宏代码破解法:

  第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,打开“Microsoft Office安全选项”窗口,选择其中的“启用此内容”,“确定”退出(图2);

使excel表格内容只读不能修改及破解

  再切换到“视图”选项卡,点击“宏”→“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:PasswordBreaker(图3),点击“确定”退出;

使excel表格内容只读不能修改及破解

  第二步:再点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗口中的所有代码:

  Sub PasswordBreaker()

  Dim i As Integer, j As Integer, k As Integer

  Dim l As Integer, m As Integer, n As Integer

  Dim i1 As Integer, i2 As Integer, i3 As Integer

  Dim i4 As Integer, i5 As Integer, i6 As Integer

  On Error Resume Next

  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

  ActiveSheet.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 ActiveSheet.ProtectContents = False Then

  MsgBox "One usable password is " & Chr(i) & Chr(j) & _

  Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _

  Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

  ActiveWorkbook.Sheets(1).Select

  Range("a1").FormulaR1C1 = Chr(i) & Chr(j) & _

  Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _

  Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

  Exit Sub

  End If

  Next: Next: Next: Next: Next: Next

  Next: Next: Next: Next: Next: Next

  End Sub

  第三步:再点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“执行”,密码就现形了(图4)。

使excel表格内容只读不能修改及破解

  第四步:切换“审阅”选项卡,点击“撤消工作表保护”,然后输入密码即可解除锁定。

[Ok3w_NextPage]

  另一个能解除Excel工作表保护的VBA脚本

  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

[Ok3w_NextPage]

  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

[Ok3w_NextPage]

  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

[Ok3w_NextPage]

  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

  -----------------------------------

  把上面的代码保存为一个宏,运行,点两次确定,等到它运行结束,工作表密密码就解除了。

  ★如果出现提示“工程不可查看”不能录制新宏,可以先使用“VBA工程加锁解锁器”来解除其“工程不可查看”后再用上面的方法找出保护密码。

  当然了,“VBA工程加锁解锁器”顾名思义,这是一个既可以解除Excel保护密码,又可以为Excel加保护密码的软件,实为一个优秀的Excel辅助工具。

[Ok3w_NextPage]

  下载地址:http://pickup.mofile.com/9306322777229726

  四、解除工作簿的保护

  如果工作簿被密码保护不能打开,我们可以也使用一些专用的破解软件进行破解

  Intelore Excel Password Recovery V1.0c

  下载地址:http://pickup.mofile.com/6508444219536677

  Passware Kit V7.1.1411 汉化版.rar

  下载地址 http://pickup.mofile.com/1349573336951801

  如果只能以只读方式打开,我们打开后另存为一个不设密码的副本,即可解除只读限制。

  有时虽然工作簿在打开时没有任何密码,但如果我们不能对工作表进行复制、移动和插入等操作,那是保护了工作簿,可以通过依次选择“工具→保护→撤消工作簿 保护”菜单命令来解除,但如果有密码的话,能够猜出来更好,否则只有新建一工作簿,将被保护的工作表内容用拖选的方法复制到新的工作簿中进行编辑。

  相信有了上面这些方法,Excel中应该没有多少东西能够瞒过你的火眼金睛,也没有多少内容让你不能左右了。

tech首页 更多tech