Accessing other parallel VBA DLLs in The Raiser’s Edge

One of the methods for writing VBA code that fires when, say a constituent is saved, is to write a VBA DLL. I have covered this previously so I won’t go into details in this post. However what do you do if you need one VBA DLL to talk to another one? For example if I make a change to a record in one VBA DLL and have installed Zeidman Development’s Audit Trail application (excuse me for the gratuitous plug there) how do I tell the audit trail to make a note of this change? The VBA events are only fired when the Raiser’s Edge GUI opens up or saves a record and not when the code does so.

The signature for the method when a connection is first made to the VBA DLL contains three parameters as shown below.

Private Sub REApplicationMTInstance_OnConnection(ByVal Application As REApplicationMT, ByVal MTDllInst As Object, Custom() As Variant)

The Application object is the REApplication object where you can obtain session context object. The other two though are not obvious at all. The MTDllInst object is of type VBAMTDll. Within this there is a property called collection that gets all the other DLLs that are to be loaded. There is also a method CallMacro with the macro name as the parameter. In theory it could be possible to use this the collection property to get hold of the other DLLs and then to call a method in one of them.

Has anybody tried this. Would love to hear about it in the comments.