Deriscope supports Visual Basic.
Any function from the list shown further below may be inserted in a Visual Basic code in order to access Deriscope from within VBA.
All Deriscope functions return TRUE on success and FALSE on failure.
Upon failure, by default a diagnostic message is returned, but it is possible to suppress that message by running the function
Because it is possible that a Deriscope function does not run at all - for example if it is called with a wrong number of parameters - is a good practice to always verify that it has returned TRUE (see example code below)
The following 2 lines should be inserted at the very top of the VBA module so that they run before any Deriscope functions are called:
Dim addin As COMAddIn
Dim adxModule As Object
The following 2 lines should be inserted in the VBA code of your custom subroutine or function so that they run before any Deriscope functions are called:
Set addin = Application.COMAddIns.Item("DeriscopeGui.AddinModule")
Set adxModule = addin.Object
Next you may call a Deriscope function named XYZ that takes as input the arguments a1, a2, ... as follows:
adxModule.XYZ a1, a2, ...
If XYZ takes no arguments, the line simplifies to:
As mentioned above, it is recommended that you check the returned boolean, in which case your code would look similar to this one:
Dim b as Boolean
b = False 'do this setting to False always before calling the XYZ function
b = adxModule.XYZ(a1, a2, ...)
If Not b Then
'... custom code here to handle the failed call properly
Below is the complete list of all VBA exported functions.
Download the workbook vba.xlsm for examples of their actual usage.