Parsing UserForm and Code Modules in VBA
Some research into what's possible with VBA and code generation of JavaScript for a proof-of-concept project . In order to parse a UserForm and VBA code modules, first enable Microsoft Visual Basic for Application Extensibility in the Tools / References feature: For this example create a simple UserForm: The Parse button should be wired up to call the Parse() subroutine in the Module1 code module. The entire source will be listed in the worksheet when this Parse routine is run. Here's the code to place in Module1: 1: Option Explicit 2: 3: Sub Macro1() 4: Form1.Show 5: End Sub 6: 7: Sub Parse() 8: Dim cmpComp As VBIDE.VBComponent 9: Dim cCont As Control 10: Dim lRow As Long 11: Dim lLine As Long 12: 13: Sheets("Sheet1").Activate 14: ActiveSheet.UsedRange.ClearContents 15: 16: lRow = 0 17: lRow = SetRow(lRow, "Show UserForm and VBA Code Modules") 18: lR...