Function wizard parameters

150 views
Skip to first unread message

valeri...@mclink.net

unread,
Mar 16, 2012, 3:59:50 AM3/16/12
to Excel-DNA
Hello Govert,
I have a few questions about function wizard.
1) Is there the possibility to call an Udf function with parameters
and get those parameters not in the pop-up? For example the parameters
could be static variables in my class, or cell values stored in cells
in the current excel worksheet.
2) If so, can I have a sort of mixed-wizard popup that let users
select one parameter in the usual way and the system loads the second
parameters elsewhere?
3) May I load in the wizard a default or suggested parameter value?
4) May I graphically interact with the graphic interface of the wizard
(buttons, text fields, etc.)?

Last,
do you have a link or suggestions on how to programmatically manage
interactions between Udf functions and Excel worksheet elements(cells,
ranges, etc.)? (The function wizard indeed interacts with the
worksheet). For example, I still don't if it is possible or thread-
safe to read or write cells value in the function body of my Ufd.
I've red through the forum but I'm still a bit confused about it.
Thanks a lot
Valerio

Govert van Drimmelen

unread,
Mar 16, 2012, 8:47:11 AM3/16/12
to exce...@googlegroups.com
Hi Valerio,

It's not clear from your question what you are trying to do. Maybe some more concrete example would make it easier to answer.

1) The Excel function wizard will display all the arguments of your function (except if you have too many arguments...). Your function could internally (not as a parameter) use static values from other types in your library in its calculation, or (if it is marked as IsMacroType-true) even read other parts of the sheet to use as part of the function calculation.

2) Instead of the 'system loading other parameters elsewhere', maybe your function can just read the values elsewhere, and not have them passed as parameters.

3) & 4) Excel doesn't have any other ways to customise the function wizard. You could make a ribbon button that pastes the function and some pre-filled parameters into the current cell, and then pops up the function wizard.

Functions that you mark with the IsMacroType=true attribute:
[ExcelFunction(IsMacroType=true)]
public double MyFunction() {...}
are able to _read_ other parts of the sheet safely (using the ExcelReference type).

Your functions cannot _write_ to other parts of the sheet easily or safely, though there are some advanced workarounds. You should rather use macros triggered by shortcut keys or a ribbon interface to trigger writing to the sheet.


Regards,
Govert

________________________________________
From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of valeri...@mclink.net [valeri...@mclink.net]
Sent: 16 March 2012 09:59 AM
To: Excel-DNA
Subject: [ExcelDna] Function wizard parameters

valerio rossi

unread,
Mar 22, 2012, 3:04:55 AM3/22/12
to exce...@googlegroups.com
Thanks and sorry for not to be so clear in the questions.
I just wanted to know the possibilities of interaction with the function wizard. Now it is all clear.
Thanks
Valerio

Reply all
Reply to author
Forward
0 new messages