Get a module indexed by position or module name
Required. Variant with either the string name of the module or an integer with its index.
Required. Variant with either the string name of the module or an integer with its index.
Private Sub Form_Load() Dim SC As ScriptControl Dim m As Module Set SC = New ScriptControl SC.Language = "JavaScript" SC.AllowUI = True SC.SitehWnd = Me.hWnd SC.UseSafeSubset = False SC.Timeout = 60 Set m = SC.Modules("GlobalModule") Set m = SC.Modules.Add("MyModule") m.AddCode "function goo(a,b,c){ return a+b+c; }" Set m = SC.Modules.Add(1) 'GlobalModule Set m = SC.Modules.Add(2) 'MyModule For Each m In SC.Modules Debug.Print m.Name Next End Sub
Private Sub Form_Load() Dim SC As ScriptControl Dim m As Module Dim f As Procedure Set SC = New ScriptControl SC.Language = "JavaScript" SC.AllowUI = True SC.SitehWnd = Me.hWnd SC.UseSafeSubset = False SC.Timeout = 60 SC.AddCode "function foo(a,b,c){ return a+b+c; }" Set m = SC.Modules("GlobalModule") m.AddCode "function goo(a,b,c){ return a+b+c; }" For Each m In SC.Modules For Each f In m.Procedures Debug.Print m.Name & "." & f.Name & "( args = " & f.NumArgs & ")" Next Next End Sub