Object: Scripting Object
Attaches an object's event sources to script functions with a given prefix.
Scripting.AttachEvents (ByVal Object As Object, ByVal ObjectName As String) As Boolean
The object that you want to attach to.
Prefix string used to map the object events for this instance. When the object fires an event named Foo, the script engine calls a subroutine named EventPrefix_Foo.
Boolean indicating of the method succeeded (True) or failed (False).
' Attach application object to its event handlers with prefix appEvents
Dim app
Set app = GetObject(, "MGCPCB.Application")
Call Scripting.AttachEvents(app, "appEvents")