如何解开excel密码的教程
发布时间:2022-08-20 08:07:31
在Excel中经常需要用到密码保护进行保护重要数据,当Excel密码忘记的时候,我们就需要用点技巧把密码给解开。接下来是小编为大家带来的如何解开excel密码的教程,希望对你有用。
如何解开excel密码的教程:
解密步骤1:首先打开EXCEL,选择视图,宏,录制新宏,新建一个宏,可以随便取个名字。
解密步骤2:先生成一个空的宏
解密步骤3:编辑这个宏,选中刚新建的宏后点击编辑按钮
解密步骤4:删除窗口所有字符,把下面的内容粘贴进入。一个字母、标点符号都不能少不能错。
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
解密步骤5:关闭掉编辑窗口
解密步骤6:在宏里选中AllInternalPasswords这个编辑好的宏,执行,并且确定数次,就OK了。


猜你喜欢
- WPS表格可以进行数据计算、分析和整理,当使用一些比较复杂的公式的时候,以前许多人都会找现成的公式来使用,甚至做成模板反复使用。WPS表格可
- win11控制面板怎么打开?有些网友刚下载安装win11系统,打开一看发现操作界面有很多不同之处,一时之间不知道该如何打开,在Win11系统
- 今天微软为远程桌面功能推出这款新系统特意推出了专门的Windows10应用,如果这款应用今后表现良好,也许会对Win32版远程桌面程序的地位
- word怎么实现一秒钟计算加减乘除?word中的加减乘除想要快速计算出来,该怎么计算呢?下面我们就来看看word快速计算加减乘除的教程,需要
- 在Excel中经常因为数据过多而不多不少也会重复录入,这个时候只能靠筛选进行删除重复项了。下面是由小编分享的excel 2003删除重复项的
- 如果您给 iPad 搭配了外接键盘,则可以使用键盘快捷键来完成一些通常需要使用鼠标、触控板或其他输入设备来完成的操作。查看键盘快捷键当您在使
- 本人有一些文字要输入到Excel表中,默认情况下,这些文字都会添加到Excel表的一个单元格中。但如果文字较多,就会使得操作界面显得拥挤。本
- excel中列数太多又不能删除怎么办?很多朋友都碰到这类问题却不知道怎么解决,所以下面小编就为大家介绍一下,来看看吧excel列数太多了怎么
- 今日,苹果发布了 iOS 15/iPadOS 15 首个公测版,并且还推送了 iOS 15/iPadOS 15 beta 2 的修订版(版本
- word页眉横线,有时候看起来很碍眼,影响到了自己文档的美观,那么word页眉横线该怎么才能去掉?本文介绍word页眉横线怎么去掉的正确方法
- 我们在打开一些word文档时,最上方显示的是兼容模式,使用这个兼容模式,会自动禁用一些功能,怎么才能更改这个模式呢?下面随小编一起来看看吧。
- ppsspp模拟器金手指怎么用?ppsspp模拟器可以支持版本众多像现在比较流行的Windows,Linux,Android,iOS操作系统
- win 7 透明效果是win 7独有的显示效果,也是win 7的一大点之一,不过如果这个功能阻碍你用电脑的体验的话,那大可以关掉它,现在就说
- 问题描述:近日很多AirPods Pro 用户表示在使用AirPods Pro的过程中,耳机中会出现噪音,有劈里啪啦的电流声。还有一些用户表
- win10系统中找不到无线网卡该怎么办?升级win10以后,发现找不到无线网卡,该怎么办呢?下面我们就来看俺这个问题的解决办法,感兴趣的朋友
- 由于用户在使用win7系统电脑时的操作不当或者其它的原因,提示错误代码0xc0000225,要如何的解决呢?本文中将会有详细的操作方法介绍,
- 由于分数在日常的工作中用到的较少,以至于很多朋友到了 Excel中根本不知道如何在Excel输入分数,今天小编就为大家简单总结一下常用分数的
- 超级减肥王APP怎么设置手势锁?超级减肥王APP是一款非常不错的减肥软件,超级减肥王APP为我们提供了各种减肥方案,帮助我们减肥,如果我们想
- 我相信每个人都可以复制粘贴,即选择要复制粘贴的内容。本文主要介绍了复制前的选择,包括选择单元格、多个单元格、整行、多行、整列和全部,然后可以
- 最近有用户反应Win10 20H2更新到21H1版本后,提示0x80070013安装失败,这是什么原因呢?该如何解决这个问题呢?下面小编就为