Remote call of module function



You can remotely call any function / sub from any module.

To install this script copy code below into the new module "MyRoutines" or into the end of exiting VBScript module (menu Properties->Modules).

 

'================== START ===============

 

'This function simply returns code of module

Function GetModuleText

       GetModuleText = CurrentModule.Text

End Function

 

'=================== END ================

 

This is remote script thats call module function:

 

'================== START ===============

 

Const SNetComRemote = "NetCom.Remote"

 

Dim Remote, Root

 

Set Remote = CreateObject(SNetComRemote)

 

With Remote

       .Host = "127.0.0.1"

       .UserName = "Administrator"

       .Password = "MyPassword"

       Set Root = .CreateRoot

End With

 

With Root

       MsgBox .ScriptModules.Module("MyRoutines").AsObject.GetModuleText

End With

 

Set Root = Nothing

Set Remote = Nothing

 

'=================== END ================