excel2007表格如何取消密码
发布时间:2023-12-16 06:54:11
在做excel表格时我们有时候会给自己的工作表加密,一旦忘记密码就会很麻烦,下面让小编为你带来excel2007表格如何取消密码的方法。
excel2007取消密码步骤如下:
打开excel,点击菜单栏的“视图”,点击二级菜单里的“宏”,选择录制宏
02在弹出来的方框中输入宏的名称,点击确认。
03重复第一步的步骤,不过这次点击“停止录制”。
04选择查看宏。
05编辑宏。
06在弹出来的代码框输入下面的代码。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
关于excel2007取消密码的相关文章推荐:
1.excel 2007取消加密保护的教程
2.excel07版解除密码的方法
3.excel2007怎么撤销保护密码


猜你喜欢
- 有Win10用户发现电脑自带的软件字体很清晰,但是打开第三方软件字体却很模糊,调整了电脑分辨率也没有效果,这该怎么办?下面小编就给大家介绍一
- 任务栏缩略图,将鼠标移动到任务栏上的图标就会显示预览缩略图的效果,如果它的效果不见了该怎么找回来呢,下面与大家一起来看看具体的设置过程Win
- Win10系统有些恶意软件会将系统时间进行修改,导致系统出错软件无法正常运行,ie浏览器证书过期失效的情况。那么如何防止时间被恶意修改?下面
- ppt怎么制作精美的视频片头?ppt中想要制作一个片头,该怎么制作漂亮的片头呢?下面我们就来看看ppt制作精美片头的教程,需要的朋友可以参考
- WPS文字怎么快速插入加减乘除符号?WPS文字软件作为金山软件的重要组成部分,其文字处理功能在日常办公中发挥着重要的作用;加减乘除可以说是经
- 当我们打开excel的时候,页面呈现为分页预览,但是我们需要的时候在普通视图中进行工作,该如何修改呢?下面就跟小编一起看看吧。excel表格
- Excel的默认设置情况下,Excel数据透视表的数字格式是默认常规的,数字中没有千分位分隔符,也没有货币符号,小数点也不规范。我们可以重新
- logviewer怎么用?logviewer支持ANSI (Windows)、OEM(DOS)、UTF-8、UTF-16、UTF-16 BE
- Excel中经常需要使用到函数进行对数值的一个四舍五入的操作,四舍五入具体该如何利用函数完成呢?接下来是小编为大家带来的excel四舍五入函
- 如果我们要对不规则区域进行合并单元格的批量操作,如下图中将 A 列转成 D 列,可以借助分类汇总功能过渡实现。但如果除了将单元格合并以外,还
- 我们在使用电脑安装软件的时候,难免会不小心安装到捆绑软件,这些捆绑软件一般都带着令人非常讨厌的弹窗广告,那我们就得想办法清理掉,其实不用通过
- 微星强袭笔记本是微星旗下一款十分优秀的旗舰产品,并且其所带的配置能够满足绝大部分用户的使用需求,那么这么一款强悍的笔记本电脑要如何才能够重装
- Windows11系统作为最新款的系统版本,在使用的过程中我们如果遇到了无法联网的情况大家知道该怎么解决吗?下面的文章就是一种解决方法,一起
- 怎么在excel表中拆分日期?当我们输入几次时,我会直接输入当前时间并使用快捷键ctrl。去做吧。让我们提取年份,并在空白单元格中输入:=年
- 为了防止突然断电,死机等对正在编辑的文档造成破坏,我们可以通过自动定时保存文件来为WPS文档上个保险。为了防止突然断电,死机等对正在编辑的文
- 全新一代MacBook Pro,其搭载的M1 PRO和M1 MAX芯片能提供强大的性能,满足4K和8K视频编辑和特效渲染需求。但对很多影视工
- 最近有Win7用户遇到系统提示“音频服务未运行”的问题,接下来我就来说说怎么解决“音频服务未运行”的问题。首先,鼠标右键点击左侧的小三角,然
- 想必大家在使用电脑的时候,经常会遇到360安全卫士弹出的360日历精选弹窗吧,让桌面看起来非常不美观,有什么办法可以屏蔽360日历精选吗?下
- wps取消隐藏怎么操作?在隐藏N张工作表之后,若需要取消隐藏,常规操作是在一张张工作表中,点击取消隐藏,需要很大的耐心与时间。分享3种快捷操
- Win10系统edge浏览器网页兼容性怎么设置?现在很多使用win10系统的用户都知道电脑自带的edge浏览器功能非常强大,根本就不需要另外