Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Returning array ...


Hi all,

I have a function that I registered to return an OPER array ('P' retur
type).

In all example I saw, here is the way it is done


Code
-------------------

OPER* __stdcall MyFunc(...)
{
static OPER sRet;
static OPER sArray[numberOfElements];

...
//do some calculation
...
// fill sArray
// affect sArray to sRet and set type of sRet to be an array
return &sRet;
}


-------------------


That works very fine but I have two questions :

1 - With this way I can return something in 'numberOfElements' cells
For exemple, if 'numberOfElements' is 3, I can return value in A1
A2 and A3

But what if I need to return value in A1, A2, A3, B1, B2, B3 (i.e
returning an array of 3 by 3)

2 - What if I don't know the number of element that I have to return.
Can I just do a 'malloc' of an array and then forget it ? ...
don't think so. I'll need to 'free' this at some moment. In othe
word, is there a way to replace static variable without having memor
leaks ?

Thanks a lot

Ni

--
nicgendro
-----------------------------------------------------------------------
nicgendron's Profile: http://www.excelforum.com/member.php...fo&userid=2515
View this thread: http://www.excelforum.com/showthread.php?threadid=39650

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Returning array ...


Ok, I found an answer, it is to pass

xltypeMulti | xlbitDLLFree in the xltype member of XLOPER

but now, another question appears :

The function is returning an array of size x and y where x and y ar
subject to change from time to time.

To see all the results, I have to select an x by y array, put a formul
in it and then press CTRL+SHIFT+ENTER.

Is there a way to simplify this process.
An example could be to select only one cells, enter the formula, pres
CTRL+SHIFT+ENTER (or not ..) and then you receives an output of x b
y.

Thanks

Ni

--
nicgendro
-----------------------------------------------------------------------
nicgendron's Profile: http://www.excelforum.com/member.php...fo&userid=2515
View this thread: http://www.excelforum.com/showthread.php?threadid=39650

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Returning array ...

Hi Nicgendron,

To see all the results, I have to select an x by y array, put a formula
in it and then press CTRL+SHIFT+ENTER.

Is there a way to simplify this process.
An example could be to select only one cells, enter the formula, press
CTRL+SHIFT+ENTER (or not ..) and then you receives an output of x by
y.


Unfortunately not. Also, questions related to xlls are better asked in
the Public.Excel.sdk newsgroup.

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning an array of unique values? Blue Max Excel Worksheet Functions 10 January 16th 08 02:51 AM
Array formula returning the cumulative sum vsoler Excel Worksheet Functions 15 June 15th 07 10:54 PM
Returning an address from an array wienmichael Excel Discussion (Misc queries) 6 May 2nd 07 02:53 AM
function returning array dreamer[_18_] Excel Programming 1 June 8th 04 10:43 AM
Returning an array in excel mick Excel Programming 2 February 16th 04 04:07 PM


All times are GMT +1. The time now is 01:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"