You must use special VBA interfaces for the macros, described in the following sections:
CBBeforeSimulation
CBAfterSimulation
CBBeforeTrial
CBAfterTrial
CBAfterRecalc
Note: If a macro returns anything other than zero (0), the simulation stops.