The general method for using VBA and EbsOpen to make automated edits is described in this post.
For macros with with “Component Calculation Mode” set to “User defined KernelScript”, the code is in the macro’s .ComponentCalculationKernelScript property and can be pulled out, edited, and put back into the macro in the same manner as in the earlier post.
You can also manipulate a macro’s pre- and post-run EbsScript. The somewhat cryptic VBA syntax is:
MacInt.GetMacroEbsScriptUserDefinedCode(epUserCodeTypeBeforeCalculation)
MacInt.GetMacroEbsScriptUserDefinedCode(epUserCodeTypeAfterCalculation)
where “MacInt” is the “Macro Interface” object as it is known WITHIN the macro context and could be set via:
Set MacInt = model.ObjectByContext("::Macro_Object::MacroInterface")