UDF for Excel in C# paramters not coming through

N

Nico

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/archive/2004/12/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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top