Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE link from Excel to Mathcad

Status
Not open for further replies.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor