View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nico[_3_] Nico[_3_] is offline
external usenet poster
 
Posts: 5
Default UDF for Excel in C# paramters not coming through

Hello,

I'm trying to get a UDF written in C# to work.

Thanks to the excellent article from Eric Carter you'll get a flying
start.
"user defined functions for Excel in .NET"
http://blogs.msdn.com/eric_carter/ar...01/273127.aspx

But when I use the function in Excel as described I get the known
#VALUE! result ;o(
When I debug I see that the parameters from Excel are not coming
through, they remain null.
When I add a function without parameters, I get result.

It gets more strange because the breakpoints do not work "anymore" on
function MultiplyNTimes, the worked at least once ;o)
On every other function I add I can create breakpoints but still no
parameters coming through ;o)

f.i.:
public double Add(object Number1, object Number2)
{
double result = 0;
Excel.Range r1 = Number1 as Excel.Range;
Excel.Range r2 = Number2 as Excel.Range;

result = Convert.ToDouble(r1.Value2) +
Convert.ToDouble(r1.Value2);

return result;
}


I'm just starting to play with c#, any clues highly appreciated!

Thx!