Hi,
I am currently working on a a project to obsfucate VBA code I use the following code from the late Chip Pearson's article on 'Programming The VBA Editor'.
Chip Pearson - Programming The VBA Editor
to get the project modules which I then loop through to obsfucate the code by generating random names for the projects variables and procedures.
Public Sub GetModules(objWorkbookToListModules As Workbook)
' +--[ GetModules ]-----------------------------------------------------------------+
' | This code stores the passed objWorkbookToListModules modules, their types and |
' | obsfucated name in array arrModules. |
' | |
' | Note : The function uses the Function ComponentTypeToString. |
' +---------------------------------------------------------------------------------+
Dim objVBComponent As VBIDE.VBComponent
Dim objVBProject As VBIDE.VBProject
Dim strVBComponentType As String
Set objVBProject = objWorkbookToListModules.VBProject
For Each objVBComponent In objVBProject.VBComponents
ReDim Preserve arrModules(intModuleCount)
Select Case objVBComponent.Type
Case vbext_ct_ActiveXDesigner
strVBComponentType = "ActiveX"
Case vbext_ct_ClassModule
strVBComponentType = "Class"
Case vbext_ct_Document
strVBComponentType = "Document"
Case vbext_ct_MSForm
strVBComponentType = "UserForm"
Case vbext_ct_StdModule
strVBComponentType = "Code"
Case Else
strVBComponentType = "Unknown"
End Select
arrModules(intModuleCount).strModuleObfuscatedName = "Obsfucated_" & strVBComponentType & "_Module" & Trim(Str(intModuleCount))
arrModules(intModuleCount).strModuleOriginalName = objVBComponent.Name
arrModules(intModuleCount).strModuleType = ComponentTypeToString(objVBComponent.Type)
intModuleCount = intModuleCount + 1
Next
Set objVBProject = Nothing
End Sub
Display More
The code is called by...
This works fine, until I try obsfucating a project that has a custom ribbon. When I receive two 400 Errors when ThisWorkbook is accessed. If I remove the Custom Ribbon XML I don't get the errors. The ribbon code for the project all works perfectly. So failing to understand why I am getting the 400 Errors ?
Probably a bit of a long shot but was wondering if anyone has experienced a similar problem ?
Regards,
Tom Rowe