Yazan Diranieh

I've written a C# automation AddIn whose public functions can be used in Excel formulas. However, I need to guard against invoking these functions from within the Function Wizard (these AddIn functions actually connect to a remote server).

Is there a direct way to know if an AddIn function (written in C#) was invoked from the function wizard One way I'm considering is enumerating the Excel app windows with EnumWindows to see if one of them is the function wizard. Any other more direct ways

Thanks

Yazan D.




Re: Visual Studio Tools for Office Detecting if a UDF is invoked from a Function Wizard

Dennis Wallentin

Hi,

If You declare the functions as private they will not be viewed in the Function Wizard but they still can be used as UDFs.
Is this a workable solution for You  






Re: Visual Studio Tools for Office Detecting if a UDF is invoked from a Function Wizard

Yazan D

Thanks Dennis. Unfortunately not. Users must be able to see these functions in the Function Wizard.

Browsing the Internet it seems that enumerating opened Windows under Excel is the proper way.

I found this link to be quite useful: http://www.decisionmodels.com/Calcsecretsj.htm

Regards

Yazan






Re: Visual Studio Tools for Office Detecting if a UDF is invoked from a Function Wizard

Dennis Wallentin

Hi Yazan,

Test if Charles approach can work for You otherwise use the enumeration approach.