Excel 请问如何破解VBA工程不可查看
3个回答
2017-07-20
温州瓯越培训学校
温州市瓯越职业培训学校是一家经温州市民政局批准成立的专门从事培训教育的正规机构,学校自1992年开创教育培训以来不断发展壮大,现开设电脑培训、会计培训、英语培训、手机维修培训等多个培训体系.
向TA提问
关注
展开全部
BA代码作为知识产权的重要内容,越来越受到高度重视。但VBA工程的保护相对而言是比较脆弱的。
我这儿有一份文件,是通过加密技术将VBA工程锁定为不可查看,全“程”含一个标准模块和三个过程约75行代码,作为测试文档,求破解。
VBA工程保护密码为"shourou".
如果您对此感兴趣,欢迎破解!
注意:应能完整破解该工程,即还原该VBA工程,而非仅仅读取或者查看到其中的过程名称或者模块名称。
代码还是能dump出来的
Module: ----------------------------------- mdlVBA -----------------------------------
Attribute VB_Name = "mdlVBA"
Option Explicit ''''显式变量声明
Option Private Module ''''外部工程禁用
Public Const gstrUSER_MSG_TITLE As String = "ExcelHome.Net"
Private Function FieldsExists(intWsIndex As Integer, Optional blnDisplayAlerts As Boolean = True) As Boolean
''''功能:检查指定工作表的字段名称与内置字段名称是否匹配
''''参数:intWsIndex:=工作表索引;blnDisplayAlerts:=不匹配时是否弹出警告对话框
Dim Ws As Excel.Worksheet
Dim astrFieldNames() As String
Dim vntHeader As Variant
Dim I As Integer
Dim intColumnSize As Integer
On Error GoTo ErrorHandler
Select Case intWsIndex
Case 1
Set Ws = Sheet1
intColumnSize = 10 ''''字段数量
ReDim astrFieldNames(1 To intColumnSize)
astrFieldNames(1) = "OfficeID"
astrFieldNames(2) = "OfficeName"
astrFieldNames(3) = "Region"
astrFieldNames(4) = "Province"
astrFieldNames(5) = "City"
astrFieldNames(6) = "Address"
astrFieldNames(7) = "StartData"
astrFieldNames(8) = "ExpiryData"
astrFieldNames(9) = "OfficeArea"
astrFieldNames(10) = "Reviser"
End Select
vntHeader = Ws.Cells(1, 1).Resize(1, intColumnSize).Value ''''标题行
For I = 1 To intColumnSize
If Not StrComp(vntHeader(1, I), astrFieldNames(I), vbTextCompare) = 0 Then Exit For
Next
If I > intColumnSize Then
FieldsExists = True
Else
If blnDisplayAlerts = True Then
MsgBox Ws.Name & Chr$(34) & vntHeader(1, I) & Chr$(34) & "与标准字段名" & Chr$(34) & astrFieldNames(I) & Chr$(34) & "不匹配。", vbExclamation, gstrUSER_MSG_TITLE
End If
End If
On Error GoTo 0
Exit Function
ErrorHandler:
If ExcelHomeErrorHandler("Private Function FieldsExists") = True Then Resume Next
End Function
Public Function FileExists(strFileName As String) As Boolean
''''功能:判断文件或者文件夹是否存在
''''参数:strFileName:=待考查的文件或者文件夹的完整路径
FileExists = (Len(Dir(strFileName, vbDirectory)) > 0)
End Function
Public Function ExcelHomeErrorHandler(strProcName As String) As Boolean
''''功能:错误处理程序
''''参数:strProcName:=出错的过程名称
Dim strErrMessage As String
strErrMessage = "程序运行在" & Chr$(34) & strProcName & Chr$(34) & "过程时发生错误。" & vbCrLf & _
"错误时间:" & Now & vbCrLf & _
"错误代号:" & Err.Number & vbCrLf & _
"错误原因:" & Err.Description
Err.Clear ''''清除错误
If MsgBox(strErrMessage & vbCrLf & "是否继续?", vbExclamation + vbYesNo, gstrUSER_MSG_TITLE) = vbYes Then
ExcelHomeErrorHandler = True
Else
With Application
.StatusBar = False ''''清空状态栏
.DisplayAlerts = True ''''恢复警告对话框
.EnableEvents = True ''''恢复事件
.ScreenUpdating = True ''''恢复屏幕更新
End With
ExcelHomeErrorHandler = False
End If
End Function
我这儿有一份文件,是通过加密技术将VBA工程锁定为不可查看,全“程”含一个标准模块和三个过程约75行代码,作为测试文档,求破解。
VBA工程保护密码为"shourou".
如果您对此感兴趣,欢迎破解!
注意:应能完整破解该工程,即还原该VBA工程,而非仅仅读取或者查看到其中的过程名称或者模块名称。
代码还是能dump出来的
Module: ----------------------------------- mdlVBA -----------------------------------
Attribute VB_Name = "mdlVBA"
Option Explicit ''''显式变量声明
Option Private Module ''''外部工程禁用
Public Const gstrUSER_MSG_TITLE As String = "ExcelHome.Net"
Private Function FieldsExists(intWsIndex As Integer, Optional blnDisplayAlerts As Boolean = True) As Boolean
''''功能:检查指定工作表的字段名称与内置字段名称是否匹配
''''参数:intWsIndex:=工作表索引;blnDisplayAlerts:=不匹配时是否弹出警告对话框
Dim Ws As Excel.Worksheet
Dim astrFieldNames() As String
Dim vntHeader As Variant
Dim I As Integer
Dim intColumnSize As Integer
On Error GoTo ErrorHandler
Select Case intWsIndex
Case 1
Set Ws = Sheet1
intColumnSize = 10 ''''字段数量
ReDim astrFieldNames(1 To intColumnSize)
astrFieldNames(1) = "OfficeID"
astrFieldNames(2) = "OfficeName"
astrFieldNames(3) = "Region"
astrFieldNames(4) = "Province"
astrFieldNames(5) = "City"
astrFieldNames(6) = "Address"
astrFieldNames(7) = "StartData"
astrFieldNames(8) = "ExpiryData"
astrFieldNames(9) = "OfficeArea"
astrFieldNames(10) = "Reviser"
End Select
vntHeader = Ws.Cells(1, 1).Resize(1, intColumnSize).Value ''''标题行
For I = 1 To intColumnSize
If Not StrComp(vntHeader(1, I), astrFieldNames(I), vbTextCompare) = 0 Then Exit For
Next
If I > intColumnSize Then
FieldsExists = True
Else
If blnDisplayAlerts = True Then
MsgBox Ws.Name & Chr$(34) & vntHeader(1, I) & Chr$(34) & "与标准字段名" & Chr$(34) & astrFieldNames(I) & Chr$(34) & "不匹配。", vbExclamation, gstrUSER_MSG_TITLE
End If
End If
On Error GoTo 0
Exit Function
ErrorHandler:
If ExcelHomeErrorHandler("Private Function FieldsExists") = True Then Resume Next
End Function
Public Function FileExists(strFileName As String) As Boolean
''''功能:判断文件或者文件夹是否存在
''''参数:strFileName:=待考查的文件或者文件夹的完整路径
FileExists = (Len(Dir(strFileName, vbDirectory)) > 0)
End Function
Public Function ExcelHomeErrorHandler(strProcName As String) As Boolean
''''功能:错误处理程序
''''参数:strProcName:=出错的过程名称
Dim strErrMessage As String
strErrMessage = "程序运行在" & Chr$(34) & strProcName & Chr$(34) & "过程时发生错误。" & vbCrLf & _
"错误时间:" & Now & vbCrLf & _
"错误代号:" & Err.Number & vbCrLf & _
"错误原因:" & Err.Description
Err.Clear ''''清除错误
If MsgBox(strErrMessage & vbCrLf & "是否继续?", vbExclamation + vbYesNo, gstrUSER_MSG_TITLE) = vbYes Then
ExcelHomeErrorHandler = True
Else
With Application
.StatusBar = False ''''清空状态栏
.DisplayAlerts = True ''''恢复警告对话框
.EnableEvents = True ''''恢复事件
.ScreenUpdating = True ''''恢复屏幕更新
End With
ExcelHomeErrorHandler = False
End If
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询