June 25, 2018
My previous post on getting started with Script Lab and the Office JS APIs for Word looked at some similarities between the COM and Word JS API object models, based on the Script Lab Basic API call sample. This time, I’ll highlight the core part of the sample code that differs from working with COM/VBA. Read the rest of this entry »
No Comments » |
Concept, Office JS API, Syntax, VBA->JS, VBA->JS;Web Add-ins | Tagged: add-in, object model, office-js, VBA->JS, Word 2016 |
Permalink
Posted by WordMeister
August 9, 2015
As is often the case with code samples, error-handling is omitted for the sake of clarity and space. But serious code requires, of course, error handling, no matter which programming language is used.
VBA is old, comparatively speaking, and classic VB, upon which it was built, even older. We’re all familiar with On Error GoTo [label]
, On Error Resume Next
and related commands.
More recent programming languages use a different pattern, generally known as “try…catch”. The .NET Framework languages use it (although VB.NET can still work with On Error
) and it’s become a widely accepted standard. This is the basic pattern in synchronous JavaScript, as well. Read the rest of this entry »
No Comments » |
Concept, Syntax, VBA->JS | Tagged: VBA->JS |
Permalink
Posted by WordMeister
July 19, 2015
An important part of most programs we write is testing the values of variables and performing tasks based on the result. Typical VBA constructs that use comparisons are If, For, ForEach and Do…While. JavaScript provides the same functionality, using pretty much the same logic, but the syntax differs.
Before we look at these in the next post, however, it’s first important to learn what operator symbols JavaScript uses, how code blocks are defined and to understand the way the Equal sign ( = ) works. Read the rest of this entry »
No Comments » |
Syntax, VBA->JS | Tagged: VBA->JS |
Permalink
Posted by WordMeister
July 16, 2015
The VB languages differentiate between concatenating (“adding”) strings and adding numbers. You’re supposed to use an ampersand (&) to concatenate a string and a plus sign (+) to add numbers. Although VBA will accept a plus sign to concatenate strings it’s frowned on as you can get unexpected results.
JavaScript (like C#) must use the same operator for both operations, the plus sign: Read the rest of this entry »
No Comments » |
Syntax, VBA->JS | Tagged: VBA->JS |
Permalink
Posted by WordMeister