trosmo
Computer
- Jul 8, 2004
- 3
I've got the folloving setup for Mathcad as an OLE object in Excel:
data := csort(data,0)
X := data(0)
Y := data(1)
S := cspline(X,Y)
fit(x) :=interp(S,X,Y,x)
a := fit(x)
Using the folloving VBA-code in Excel I can poke the x-value into the OLE-object and update the calculation, but I cant get the a-value back to Excel. It looks like there is something wrong with my "GetComplex"-syntax. I would appreciate if anyone could give me a hint for the right syntax....????
Dim MathcadObject As Object
Dim OutVar As Variant
Dim InVar As Variant
Set MathcadObject = ActiveSheet.OLEObjects(1).Object
InVar = ActiveSheet.Range("P15").Value
Call MathcadObject.SetComplex("x", InVar)
Call MathcadObject.Recalculate
Call MathcadObject.GetComplex("a", OutVar)
ActiveSheet.Range("P17").Value = OutVar
data := csort(data,0)
X := data(0)
Y := data(1)
S := cspline(X,Y)
fit(x) :=interp(S,X,Y,x)
a := fit(x)
Using the folloving VBA-code in Excel I can poke the x-value into the OLE-object and update the calculation, but I cant get the a-value back to Excel. It looks like there is something wrong with my "GetComplex"-syntax. I would appreciate if anyone could give me a hint for the right syntax....????
Dim MathcadObject As Object
Dim OutVar As Variant
Dim InVar As Variant
Set MathcadObject = ActiveSheet.OLEObjects(1).Object
InVar = ActiveSheet.Range("P15").Value
Call MathcadObject.SetComplex("x", InVar)
Call MathcadObject.Recalculate
Call MathcadObject.GetComplex("a", OutVar)
ActiveSheet.Range("P17").Value = OutVar