what is wrong with this code? (when used in the excel_addin)

N

NA_AB

hey friends,

public int addme(params object[] list)
{
// sum all the integers included in list
int sum = 0;
foreach (object o in list)
if (o.GetType() == typeof(int))
sum += (int)o;
return sum;
}

this code works fine as a stand alone code but when am trying to invoke the
"addme" function from excel by saying "=addme(10,20,30)" or "=addme(10,20)"
in the excel cell, it is not returning me the sum. All I see is "#VALUE!" in
that excel cell.

kindly let me know what should be done in this regard...
 
T

The Code Cage Team

Where is that code from and how are you invoking it in Excel when it
works said:
hey friends,

public int addme(params object[] list)
{
// sum all the integers included in list
int sum = 0;
foreach (object o in list)
if (o.GetType() == typeof(int))
sum += (int)o;
return sum;
}

this code works fine as a stand alone code but when am trying to invoke
the
"addme" function from excel by saying "=addme(10,20,30)" or
"=addme(10,20)"
in the excel cell, it is not returning me the sum. All I see is
"#VALUE!" in
that excel cell.

kindly let me know what should be done in this regard...


--
The Code Cage Team

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com)
 
N

NA_AB

this code when written in a simple console application and when this
function is called, it is getting executed perfectly with variable number of
arguments.

But, when am using the same code in "connect.cs" of the excel addin project,
and invoking this function from MS Excel(2003) as '=addme(10,20)' or
'=addme(10,20,30)' it is not giving any result, it is simply showing a
"#VALUE!"

thanks in advance... any help is considered very thankful..
 

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