tags:

views:

21

answers:

0

Hi:

I am trying to implement a UDF using Excel COM Add-in(2003) with Visual Studio 2005 in C#. I would like to implement the UDF using async programming. The UDF is a slow operation as its results are fetched from a server.

As an illustration(not a real world example),the following UDF works fine without any issue:

 public double mul(double number1, double number2)
  {
     return number1 * number2;
  }

How can I do the same functionality in an async way: For example, I would like the UDF return immediately and later when the results are available from a server, I would like to update the desired cells.

 // This method returns immediately.
public object mul(double number1, double number2)
{
    return "calculating";
}


// This method of a worker thread will update the results.
public OnResultsAvailable(object result)
{

// Question: how should I update the cells that triggerred the calcualtions above?
}

Constraints: I cannot use Excel RTD as I have to work with existing codebase written using Excel C# COM Add-in.

Thanks for the help.

-Venu