We are aware of an issue causing intermittent login problems for some users following a recent update. Learn More
I've developed an application using an embedded MathCAD worksheet in Excel. The macro passes an array of input data into MathCAD and retrieves an array of calculation results. I would like to be able to save the embedded MathCAD file as a stand alone .xmcd file using a macro. I'm very confused about the format of the SaveAs function since the Developer's guide doesn't provide an example that uses it. Can anyone please provide some format/info/example on its use? Thank you very much.
My code is:
Sub Save_MathCAD_Object()
' Define variables and types
Dim MathcadObject As OLEObject
Dim file_loc As String
' Unprotect worksheet
Sheets("Embedded_MathCAD_file").Unprotect Password:="SDC_224"
file_loc = Sheets("Embedded_MathCAD_file").Cells(2, 1)
' Set a reference to the Mathcad object on the sheet
Set MathcadObject = Sheets("Embedded_MathCAD_file").OLEObjects(1)
' Save MathCAD file
MathcadObject.SaveAs "C:\Users\sdcollins\Desktop\MathCADFiles\Test.xcmd", 0
' Protect worksheet
Sheets("Embedded_MathCAD_file").Protect Password:="SDC_224"
End Sub