我来我网
https://5come5.cn
您尚未
登录
注册
|
菠菜
|
软件站
|
音乐站
|
邮箱1
|
邮箱2
|
风格选择
|
更多 »
vista
鍙よ壊涔﹂
card
wind
绮夌孩濂抽儙
帮助
统计与排行
无图版
我来我网·5come5 Forum
»
电脑技术
»
程序员之家
»
【转帖】如何[屏蔽]Excel工作表密码保护!
交 易
投 票
本页主题:
【转帖】如何[屏蔽]Excel工作表密码保护!
显示签名
|
打印
|
加为IE收藏
|
收藏主题
|
上一主题
|
下一主题
水哥
∷
性别:
∷
状态:
∷
头衔:
无知和妄为!!!
∷
等级:
人见人爱
∷
家族:
KOP★红军魂
∷
发贴:
4999
∷
威望:
1
∷
浮云:
1152
∷
在线等级:
∷
注册时间: 2007-07-05
∷
最后登陆: 2008-06-26
【
复制此帖地址
只看此人回复
】
5come5帮你背单词 [
invent
/in'vent/
n. 发明,创造,虚构,捏造
]
【转帖】如何[屏蔽]Excel工作表密码保护!
如何[屏蔽]Excel工作表密码保护!
1\打开文件
2\工具---宏----录制新宏---输入名字如:aa
3\停止录制(这样得到一个空宏)
4\工具---宏----宏,选aa,点编辑按钮
5\删除窗口中的所有字符(只有几个),替换为下面的内容你复制吧)
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 & "lease 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 & _
"roceeding 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
6\关闭编辑窗口
7\工具---宏-----宏,选AllInternalPasswords,运行,确定两次,等2分钟,再确定.OK,没有密码了!!
Posted: 2007-11-06 13:58 |
[楼 主]
快速跳至
|- 站务管理
|- 惩罚,奖励公布区
|- 会员咨询意见区
|- 申请区
|- 已批准申请区
|- 威望和荣誉会员推荐区
|- 5come5名人堂·Hall of Fame
>> 休闲娱乐
|- 灌水乐园 大杂烩
|- 精水区
|- 幽默天地
|- 开怀大笑(精华区)
|- 灵异空间
|- 运动新时空·菠菜交流
|- 动之风.漫之舞
|- 新货上架
|- 古董挖挖
|- 唯美贴图
|- 创意&美化&设计
|- 5COME5头像及签名档图片引用专区
|- 艺术摄影
|- 音乐咖啡屋
|- 音道乐经
>> 热点讨论
|- 工作交流
|- 求职信息
|- 就业精华区
|- 同城联谊
|- 留学专版
|- 情感物语
|- 情感物语精华区
|- 带走一片银杏叶
|- 精华区
|- 新闻直通车
|- 众志成城,抗震救灾
|- 衣食住行
|- 跳蚤市场
|- 旅游出行
>> 学术交流
|- 学业有成
|- 智力考场
|- 考研专版
|- 外语乐园
|- 考试·毕业设计
|- 电子设计·数学建模
|- 学生工作·社团交流·RX
|- 电脑技术
|- 电脑F.A.Q.
|- 软件交流
|- 硬件·数码
|- 程序员之家
|- Linux专区
|- 舞文弄墨
|- 历史&文化
|- 军临天下
|- 军事精华区
|- 财经频道
>> 游戏新干线[电子竞技俱乐部]
|- Blizz@rd游戏特区
|- WarCraft III
|- 魔兽区档案库
|- 魔兽争霸3博彩专区
|- StarCraft(new)
|- 暗黑专区
|- 休闲游戏区
|- PC GAME综合讨论区
|- 实况足球专区
|- Counter-Strike专区
|- TV GAME& 模拟器
|- 网络游戏
>> 资源交流
|- 恋影部落
|- 连续剧天地
|- 综艺开心档
|- 书香小筑
|- 小说发布
|- 资源交流
|- 综艺、体育、游戏资源发布
|- 音乐资源发布区
|- 电影电视剧发布区
|- 字幕园地
我来我网·5come5 Forum
»
程序员之家
Total 0.006928(s) query 6, Time now is:11-23 03:43, Gzip enabled
Powered by PHPWind v5.3, Localized by
5come5 Tech Team
,
黔ICP备16009856号