Skip to main content
1-Visitor
September 14, 2024
Solved

Mathcad 15 to Mathcad Prime

  • September 14, 2024
  • 1 reply
  • 1247 views

Hi,
On Mathcad 15 I used a VB script to recalculate the worksheet using a "worksheet.Recalculate()" comment assigned to a button, but this comment not working on the PTC Mathcad Prime API.

Can you help me to solve this.

Best answer by Werner_E

The method is now called Worksheet. Synchronize()

See attached a Prime 10 sheet with a "recalculate" button.

The Prime help is a nightmare, especially when it comes do the API and the advanced controls. It definitely does not deserve to be called “help” and certainly not “documentation”.
Nevertheless, somewhere in the depths of this “Help” you will find the very button that I use in the attached sheet.
Unfortunately, I couldn't find the place in the confusing help where this button comes from. It is neither in the description of the controls button, nor in its example, nor in the “documentation” of the API.
However, I definitely know that I once copied it from the Prime help ...

Here is the script (JScript) used in the button

 

function PushBtnEvent_Start(Inputs, Outputs) {
};

function PushBtnEvent_Exec(Inputs, Outputs) {
};

function PushBtnEvent_Stop(Inputs, Outputs) {
};

function PushBtn_Click(Inputs, Outputs) {
 var Mathcad = new ActiveXObject("MathcadPrime.Application");
 if (Mathcad != null) {
 var Worksheet = Mathcad.ActiveWorksheet;
 if (Worksheet != null) {
 Worksheet. Synchronize();
 Worksheet = null;
 }
 Mathcad = null;
 }
};

 

 

EDIT: Heureka! Finally found the help page where the button stems from. Shouldn't help be more intuitive to use ....?

-> Worksheet Settings

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
September 14, 2024

The method is now called Worksheet. Synchronize()

See attached a Prime 10 sheet with a "recalculate" button.

The Prime help is a nightmare, especially when it comes do the API and the advanced controls. It definitely does not deserve to be called “help” and certainly not “documentation”.
Nevertheless, somewhere in the depths of this “Help” you will find the very button that I use in the attached sheet.
Unfortunately, I couldn't find the place in the confusing help where this button comes from. It is neither in the description of the controls button, nor in its example, nor in the “documentation” of the API.
However, I definitely know that I once copied it from the Prime help ...

Here is the script (JScript) used in the button

 

function PushBtnEvent_Start(Inputs, Outputs) {
};

function PushBtnEvent_Exec(Inputs, Outputs) {
};

function PushBtnEvent_Stop(Inputs, Outputs) {
};

function PushBtn_Click(Inputs, Outputs) {
 var Mathcad = new ActiveXObject("MathcadPrime.Application");
 if (Mathcad != null) {
 var Worksheet = Mathcad.ActiveWorksheet;
 if (Worksheet != null) {
 Worksheet. Synchronize();
 Worksheet = null;
 }
 Mathcad = null;
 }
};

 

 

EDIT: Heureka! Finally found the help page where the button stems from. Shouldn't help be more intuitive to use ....?

-> Worksheet Settings

 

1-Visitor
September 16, 2024

Thank you so much.