LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default How Many Arguments?

Is it possible in a C based .xll function that takes a variable number
of arguments, to determine how many arguments were actually given?

In VBA

Function NumArgs(ParamArray Args() As Variant) As Integer
NumArgs = UBound(Args()) + 1
End Function

does the trick.

In the FuncSum example function from the SDK's Generic.c I do not see a
corresponding approach. I could loop through px1 through px29 and
determine which ones do not have xltypeMissing; but that would not
distinguish between =FuncSum() and
=FuncSum(,,,,,,,,,,,,,,,,,,,,,,,,,,,,), where in one case no arguments
were given and in the other 29 missing arguments were given.

Also, is it possible to either program or register FuncSum in such a way
that at least one argument must be given before Excel will call the
function? For example the worksheet function SUM produces an error
dialog if you attempt to enter =SUM(); you must give SUM at least one
argument, even if that argument is missing.

I know that it is not possible to exactly reproduce all behavior of
native Excel functions in user defined functions (either VBA or .xll).
For example Excel 3-D references cannot be passed to either type of UDF
(though some have kludged alternative structures to preserve the
functionality). Are these more examples of incompletely supported features?

Jerry

 
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
IF - more than seven arguments Hannah Excel Worksheet Functions 2 March 25th 10 09:21 AM
IF-more than 7 arguments Carolina Excel Discussion (Misc queries) 3 May 20th 08 10:38 PM
IF-more than 7 arguments in Carolina Excel Worksheet Functions 2 May 20th 08 08:46 PM
And, if, arguments.... Chuck_in_Mo Excel Worksheet Functions 19 February 12th 07 03:42 PM
arguments gemini0662 Excel Discussion (Misc queries) 9 July 13th 06 03:48 PM


All times are GMT +1. The time now is 09:17 AM.

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

About Us

"It's about Microsoft Excel"