http://www.oschina.net/code/snippet_54124_15443
使用UltreEdit之类的十六进制编辑程序打开.XLS文件,在文本模式下查找“[Host Extender Info]”(也可只查Host),切换到十六进制模式,将前面的“DBP="XXXXXXX...”的DBP关键字改成CBP,将“GC= "XXXXXXX...”的GC关键字改成CC,使Excel不能识别此二项!存盘即可!!!
用Excel打开此文件,忽略错误提示,进入VBA编辑器,嘿嘿,密码没有了!做一次存盘操作即可修复错误提示。
Access的VBA工程密码采用无法破解!
==> 经过测试,的确可以清除密码,但同时内容原有的VB代码也不再了。并且存盘操作后,进入VBA 后仍会报错误。
-------------
==> 经测试,以下首段代码运行后,的确可以去除VBA 的保护密码。
在很多地方我都说过,Excel VBA的工程密码是很脆弱的,其实吧里很早就有一篇这样的贴子,我也将其整理为加载宏不过还是有很多朋友在问:)。现将主程序的源代码也整理于此。如果不 懂VBA的朋友,也可以去下载我整理的加载宏(点击下载,需要注册)。
'1>一段极好的VBA保护密码破解程序测试WIN98+OFFICE97破解率100%
'2>用以下代码对VBA加密保护后用offkey 6.5-7.0及Advanced VBA pASSWORD Recovery专业版均无法破解出保护程式码的密码
'移除VBA编码保护
标签: <无>
代码片段(1)[全屏查看所有代码]
1. [代码][ASP/Basic]代码
002 | Dim FileName As String |
003 | FileName = Application.GetOpenFilename( "Excel文件(*.xls & *.xla),*.xls;*.xla" , , "VBA破解" ) |
004 | If FileName = CStr ( False ) Then |
007 | VBAPassword FileName, False |
012 | Dim FileName As String |
013 | FileName = Application.GetOpenFilename( "Excel文件(*.xls & *.xla),*.xls;*.xla" , , "VBA破解" ) |
014 | If FileName = CStr ( False ) Then |
017 | VBAPassword FileName, True |
020 | Private Function VBAPassword(FileName As String , Optional Protect As Boolean = False ) |
021 | If Dir(FileName) = "" Then |
024 | FileCopy FileName, FileName & ".bak" |
026 | Dim GetData As String * 5 |
027 | Open FileName For Binary As #1 |
032 | If GetData = "CMG=" "" Then CMGs = i |
033 | If GetData = "[Host" Then DPBo = i - 2: Exit For |
037 | MsgBox "请先对VBA编码设置一个保护密码..." , 32, "提示" |
041 | If Protect = False Then |
043 | Dim s20 As String * 1 |
049 | Get #1, DPBo + 16, s20 |
052 | For i = CMGs To DPBo Step 2 |
057 | If (DPBo - CMGs) Mod 2 <> 0 Then |
058 | Put #1, DPBo + 1, s20 |
060 | MsgBox "文件解密成功......" , 32, "提示" |
062 | Dim MMs As String * 5 |
065 | MsgBox "对文件特殊加密成功......" , 32, "提示" |
070 | ------------------------------------------------------------------------------------- |
074 | Private Sub CommandButton1_Click() |
076 | Worksheets( "这里为你要显示的工作表名称" ).Visible = True |
082 | Private Sub VBAPassword() |
084 | Filename = Application.GetOpenFilename( "Excel文件(*.xls & *.xla & *.xlt),*.xls;*.xla;*.xlt" , , "VBA破解" ) |
085 | If Dir(Filename) = "" Then |
086 | MsgBox "没找到相关文件,清重新设置。" |
089 | FileCopy Filename, Filename & ".bak" |
092 | Dim GetData As String * 5 |
093 | Open Filename For Binary As #1 |
098 | If GetData = "CMG=" "" Then CMGs = i |
099 | If GetData = "[Host" Then DPBo = i - 2: Exit For |
103 | MsgBox "请先对VBA编码设置一个保护密码..." , 32, "提示" |
107 | If Protect = False Then |
109 | Dim s20 As String * 1 |
115 | Get #1, DPBo + 16, s20 |
118 | For i = CMGs To DPBo Step 2 |
123 | If (DPBo - CMGs) Mod 2 <> 0 Then |
124 | Put #1, DPBo + 1, s20 |
126 | MsgBox "文件解密成功......" , 32, "提示" |
135 | Private Sub VBAPassword() |
137 | Filename = Application.GetOpenFilename( "Excel文件(*.xls & *.xla & *.xlt),*.xls;*.xla;*.xlt" , , "VBA破解" ) |
139 | If Dir(Filename) = "" Then |
140 | MsgBox "没找到相关文件,清重新设置。" |
143 | FileCopy Filename, Filename & ".bak" |
146 | Dim GetData As String * 5 |
147 | Open Filename For Binary As #1 |
152 | If GetData = "CMG=" "" Then CMGs = i |
153 | If GetData = "[Host" Then DPBo = i - 2: Exit For |
157 | MsgBox "请先对VBA编码设置一个保护密码..." , 32, "提示" |
163 | Dim s20 As String * 1 |
169 | Get #1, DPBo + 16, s20 |
172 | For i = CMGs To DPBo Step 2 |
177 | If (DPBo - CMGs) Mod 2 <> 0 Then |
178 | Put #1, DPBo + 1, s20 |
180 | MsgBox "文件解密成功......" , 32, "提示" |