Skip to main content
1-Visitor
October 5, 2012
Solved

Mathcad 15 VB 6.0 automation error.

  • October 5, 2012
  • 1 reply
  • 6715 views

Hi,

I am using Mathcad 13 - VB 6.0 OLE automation for calculations.

Everything was working fine till now. We are planning an upgrade to MathCAD 15.

When I tested the same VB application on MathCAD 15 version am receiving the following error. See the attached screenshot.

System Config: Windows server 2008 standard 64 bit, VB 6.0, Microsoft Office 2010.

Please let me know how can I resolve this issue.

Thanks,

Ram

Best answer by ViacheslavMezen

MC15AutomationAPI.PNG

Private Sub cmdCalc_Click()

Dim Var1 As New Mathcad.NumericValue

Dim MathcadApplication As Mathcad.IMathcadApplication2

Set MathcadApplication = New Mathcad.Application

MathcadApplication.Visible = False

MathcadApplication.Worksheets.Open "d:\TestMathcad15.xmcd"

Var1.Real = CInt(txtval.Text)

MathcadApplication.ActiveWorksheet.SetValue "A", Var1.Real

MathcadApplication.ActiveWorksheet.Recalculate

Var1 = MathcadApplication.ActiveWorksheet.GetValue("B")

txtOut.Text = Var1.AsString

Set Var1 = Nothing

MathcadApplication.ActiveWorksheet.Close mcDiscardChanges

MathcadApplication.Quit

End Sub

1 reply

19-Tanzanite
October 5, 2012

This is the same computer that you yested it on with MC13, and with MC13 it worked?

1-Visitor
October 5, 2012

Yes. It gave perfect results with MC13. I have tested it on the server.

But, When tested the same application on MC15. It is giving the error mentioned in the earlier message.

What do u think may be causing it?

19-Tanzanite
October 5, 2012

I don't know. Do you really have an object called "~", with a method called "~"?