How to Nest Function MacrosID: Q64094
|
Function macros can be nested by either specifically stating the name of the submacro in the dependent function macro, or by dynamically passing the name of a function macro to the dependent macro as a parameter. (Note: this is true for version 5.0 macro sheets, but not modules.)
A function macro can call a second function macro by specifically
calling the second function macro. This would cause the main function
macro to execute, then call the second function macro. When the second
function macro is finished, it will return the calculated value to the
location where it was called.
For example:
=MACRO1.XLM!MAIN(1,2)
A1: Main B1: Add
A2: =ARGUMENT("x",1) B2: =ARGUMENT("i")
A3: =ARGUMENT("y",1) B3: =ARGUMENT("j")
A4: =add(x,y) B4: =i+j
A5: =RETURN(A4) B5: =RETURN(B4)
=MACRO1.XLM!MAIN(MACRO1.XLM!ADD,1,2)
A1: Main B1: Add
A2: =ARGUMENT("myfunc",8) B2: =ARGUMENT("i")
A3: =ARGUMENT("x",1) B3: =ARGUMENT("j")
A4: =ARGUMENT("y",1) B4: =i+j
A5: =myfunc(x,y) B5: =RETURN(B4)
A6: =RETURN(A5)
"Functions and Macros," versions 2.x, pages 176-182 "User's Guide," version 3.0, pages 567-576
Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 4.0 4.0a 4.00a 5.0
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: July 23, 1999