I have a c#
function defined through excel DNA :
[ExcelFunction(Description = "does stuff", IsVolatile = false, IsMacroType = true, IsThreadSafe = true)]
public object AFunction(long k \* other parameters *\)
{
// do stuff
}
that is called in VBA as follows :
Dim v As Variant
v = Application.Run("AFunction", k)
Now I modify my excel DNA c#
as follows :
[ExcelFunction(Description = "Retrieves valo folio", IsVolatile = false, IsMacroType = true, IsThreadSafe = true)]
public object AFunction(ref double x, long k \* other parameters *\)
{
// do stuff
// update x
}
the idea being that I will pass to it a double
that will be updated, and that I will use after.
I call this in VBA as follows :
Dim v As Variant
v = Application.Run("AFunction", x, k)
But x
("dimed" as Double
) is not updated. I tried a
Dim x() as Double
Redim x(1)
and a
Dim v As Variant
v = Application.Run("AFunction", x(1), k)
but here also x(1)
is not updated.
Is there a problem with the ref
in the c#
, or is the problem caused by the Application.Run
?