Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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");
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.
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
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?
See:
Mathcad Prime API Example: JavaScript | PTC
My issue and complaint is that PTC claims that it is a JavaScript example, but it really isn't. Its a VBA embedded in JavaScript example. It only works in Internet Explorer (depreciated) and .hta (which is really internet explorer). Doesn't work in Edge, Don't work in Office Add-In development and as far as I can tell there is no way to actually call MathCAD from JavaScript despite the "JavaScript" claims. This severely limits the usefulness of the API,
