Skip to main content
3-Newcomer
May 7, 2025
Question

Using MathCAD API with Office Add-Ins

  • May 7, 2025
  • 1 reply
  • 1008 views

Microsoft is depreciating Visual Basic for Applications and is moving to JavaScript based office add-ins.  The office add-ins do not support the COM model.  How can I connect the office add-ins in JavaScript with the MathCAD API?  The office add-ins do not support ActiveXObjects anymore, so the Add-in fails if you try to use:

 

mathcad = new ActiveXObject("MathcadPrime.Application");

1 reply

16-Pearl
May 12, 2025

Stand-alone VBScript is being deprecated in favor of JavaScript and PowerShell.  VBA is not going away. There is too much code written in Microsoft's user base.  They've offered alternatives, but VBA is too entrenched.   See here.

3-Newcomer
May 13, 2025

Perfect, so to your point, including the javascript code in an Office Add-In such as:

 // Get the Mathcad Prime COM application object:
 mathcad = new ActiveXObject("MathcadPrime.Application");
 mathcad.Visible = true;
 mathcad.Activate();

Still obviously works then?

 

It definitely won't say:

Uncaught runtime errors:
×
ERROR
ActiveXObject is not defined
ReferenceError: ActiveXObject is not defined
16-Pearl
May 14, 2025

Sorry.  Merely commenting on your first statement on VBA being deprecated.  Not sure about the API call from JavaScript.  Does this call work in VBA?