function returning multiple arguments and/or byref arguments

Mar 13, 2014 at 8:36 AM

First of all: what a great library is this. Fabulous.

I have a function that has multiple arrays as a result. I have been puzzled by how to return these to Excel. I am used to use ByRef arguments (modify in place) in such cases - but cannot figure out how to get this done with the xll library.

My questions:
  • is there a way to pass multiple arguments back to Excel (I can also call the xll functions with Application.Run - I am not restricted to a function call from a worksheet)
  • if not, is there a way to pass ByRef arguments - so I can fill these with my function results?
I read that the xll SDK allows for 'modify in place' arguments - so I am hopeful that there is a way.

Any help is greatly appreciated.
Mar 13, 2014 at 12:34 PM
Thanks absvm. The Excel SDK provides for OPERs of type xltypeRef that consists of an array of references, but these are intended for input, not output.
The SDK only allows modifying one argument in place because modifying more than one argument would break Excel's functional paradigm.
The way I return hierarchical data is to use handles to OPERs. See for examples of how to do that.