You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation of 2 methods ensures something that something which previously was not possible now is, although currently not optimally, more about that towards the end.
RegisterAsActiveObject
Description
Put an active object into the Running Object Table, and register it to a specified GUID (CLSID). From here other applications can use (and drive) your VBA application.
Example
The following example registers the myObj object as GUID e3cc5a52-6f89-41e3-9714-9502146a840a. This object can then be accessed from other processes via VBA's equivalent of GetObject("{e3cc5a52-6f89-41e3-9714-9502146a840a}").
Call RegisterAsActiveObject on a newly created GUID.
Launch a binary/PowerShell script which connects to the object (via GUID) and continually calls a method every iMilliseconds milliseconds. If the object disconnects, close powershell runtime.
Implementation Option 2 (Long Term)
Create a thunk which calls a method on an object pointer every iMilliseconds milliseconds.
Pass pointer into thunk
Resolve any crashes that occur, e.g. when object is un-allocated.
Example
The following example registers the myObj object as GUID e3cc5a52-6f89-41e3-9714-9502146a840a. This object can then be accessed from other processes via VBA's equivalent of GetObject("{e3cc5a52-6f89-41e3-9714-9502146a840a}").
classMyClassPublicFunctionOnTick()staticiaslong:i=i+1'increase every 100msEndFunctionendclassModuleTestDimmyObjasMyClasssubrun()setmyObj=newMyClassstdCOM.Create(myObj).OnTimeCall("OnTick",100)endsubendclass
Potential issues
Unsure but may have difficulty calling methods in Break Mode.
The text was updated successfully, but these errors were encountered:
Implementation of 2 methods ensures something that something which previously was not possible now is, although currently not optimally, more about that towards the end.
RegisterAsActiveObject
Description
Put an active object into the Running Object Table, and register it to a specified GUID (CLSID). From here other applications can use (and drive) your VBA application.
Example
The following example registers the
myObj
object as GUIDe3cc5a52-6f89-41e3-9714-9502146a840a
. This object can then be accessed from other processes via VBA's equivalent ofGetObject("{e3cc5a52-6f89-41e3-9714-9502146a840a}")
.OnTimeCall(sMethodName,iMilliseconds)
Implementation Option 1 (Short term)
RegisterAsActiveObject
on a newly created GUID.iMilliseconds
milliseconds. If the object disconnects, close powershell runtime.Implementation Option 2 (Long Term)
iMilliseconds
milliseconds.Example
The following example registers the
myObj
object as GUIDe3cc5a52-6f89-41e3-9714-9502146a840a
. This object can then be accessed from other processes via VBA's equivalent ofGetObject("{e3cc5a52-6f89-41e3-9714-9502146a840a}")
.Potential issues
Unsure but may have difficulty calling methods in Break Mode.
The text was updated successfully, but these errors were encountered: