>
> I'm writing an XLL based on the examples in the SDK for Excel 97.
> Everything works OK except that it'd be nice to have the types of the
> inputs displayed next to the input boxes, just as in the 'native' Excel
> examples. This also allows types to be coerced automatically - eg 12/12/97
> will be interpreted as a date, not '12 divided by 12 divided by 97'
>
> Does anyone know how to do this? It's not documented in any of the
> Microsoft docs or the Knowledge Base.
>
> Thanks,
>
> Andrew Colin
> Sydney.
I don't know how to display the types of the inputs displayed next to the input boxes in
the wizard, but you could be interested by the following precisions about xlfRegister:
The description of this function is truncated in the SDK. The authors have kept the
definition of the FIRST xlfRegister function (the one of EXCEL 4!!!) and they don't have
updated it, whereas the new xlfRegister function (Excel 5 and above) supports more
arguments. With these new arguments, you can pass to xlfRegister a description string
for each parameter of your UDF, which will be displayed by the function wizard.
If you want to get a complete description of xlfRegister, open the file "Macrofun.hlp"
(directory "xlm" in the CD-ROM provided with the SDK), and search the topic REGISTER.
Here is an example of a complete UDF registration which I have used recently. This
"ESPERVIE" function calculates an "esperance de vie" (life expectancy). It returns a
pointer to an OPER structure and is based on four arguments : two FP structures (type
"K") and two OPERs (type "P"). The five last parameters passed to xlfRegister, displayed
by the function wizard, describe the function and each of its arguments.
When the user selects ESPERVIE in the function wizard and calls the help, it opens the
help file "Mortalit.hlp" and activates the help topic number 0.
Excel(xlfRegister,0,14,&xModuleText,TempStr(" Espervie"),
TempStr(" PKKPP"),TempStr(" ESPERVIE"),TempStr(" Deces,Pop,Age,Annees"),
TempNum(1),TempStr(" Indicateurs de mortalitй"),TempMissing(),
TempStr(" C:\\Program Files\\XLLs\\Mortalit.hlp!0"),
TempStr(" Calcule une espйrance de vie"),
TempStr(" Effectifs cumulйs de dйcиs par classes d'вge (en 5)"),
TempStr(" Population par classes d'вge quinquennales"),
TempStr(" Age de base (par dйfaut : 0)"),
TempStr(" Nombre d'annйes de dйcиs (par dйfaut : 1) "));
Another advice : avoid the XLOPER arguments (type "R") in your user defined functions;
if you just want to get the passed values and no range references, use rather OPER
arguments ("P"). Two reasons for this : when a XLOPER structure refers to a cell
containing the RAND() function, trying to coerce this XLOPER can either return a zero if
the structure contains a single value, or entail a GPF if it contains an array (at least
in Excel 97).
I don't know if this bug has been corrected by the SR1. It arises even if you do a
xlRetUncalced test. And with OPER structures you don't have to use xlCoerce at all
(Excel does it automatically before calling the function).
Cordialement,
Laurent Longre