Microsoft has a new way to collect product feedback: UserVoice.

For as long as I can remember, it’s seldom been possible to provide feedback about Office to Microsoft. There has been the occasional conduit, hidden away, but on the whole it’s been like throwing spit balls at a brick wall…

This has changed for developers. For how long no one knows, but take advantage of it while it lasts! You can post an idea and link to it so that like-minded folks can up-vote it in order to give it more weight:

Office Developer portal

The Microsoft folks are reading and evaluating these, so take care to provide a clear, logical presentation, with example scenarios as to why the point is important.

Comments No Comments »

The previous post discussed how to find out what Word Open XML is required in order to insert a particular type of content. This article will consider a practical example and demonstrate how the Word Open XML can be stored in a resource file, then loaded and modified by JavaScript code before being inserted into the Word document. Read the rest of this entry »

Comments No Comments »

In both the posts about Coercion types in Word Web Add-ins and reading built-in document properties a key point is using the Word Open XML file format in order to achieve something not available in the APIs. This approach works only in Word and it can be used for almost anything. Even the newer, extended APIs that will be released for Office 2016 won’t (initially) provide functionality for everything that can be contained in a Word document. So working with the Word Open XML file format is a useful tool for the JavaScript as well as the VBA and .NET developer. Read the rest of this entry »

Comments No Comments »

I hope you’ve had a chance to think about the code in the previous post for reading the value of a document property. This post will consider the problem of looping when async calls are involved, using that as the basis for the discussion. Read the rest of this entry »

Comments No Comments »

Besides writing to a specified place in a document, the other major thing an “App for Word” can do is communicate with Custom XML Parts. Mainly, I suppose the reason this was included in the original APIs is because Word can link a content control to a node in a Custom XML Part. Changing the content of either the content control or the node will mirror that change at the other end of the link. This capability is of interest for “data-mining” documents since it’s a fairly simple task to read a Custom XML Part from a closed Word document by leveraging the Office Open XML. Read the rest of this entry »

Comments No Comments »

Here’s another tool where you can try out JavaScript, on-line: JS Fiddle. The link is to the tutorial page, in the documentation. The actual editor is here.

Microsoft provides a number of resources, besides the documentation on MSDN, for learning about the Office (2013) APIs. Read the rest of this entry »

Comments 2 Comments »

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 »

Comments No Comments »

Here are a some tips for improving your “experience” in the Visual Studio IDE when testing the Office APIs. Read the rest of this entry »

Comments No Comments »

Not quite ready for access by the broad public, apparently…

The post will be back up in the near future! Sorry for any confusion.

Comments No Comments »

In the last four installments, the basics of creating a Web Add-in and reading/inserting information was introduced, using two different data formats: matrix and plain text. When working with Word, especially, formatting can be just as important as text content. For this reason, Word supports more and complexer content types than the other Office applications. This post focuses on using these coercion types in a Web Add-in. Read the rest of this entry »

Comments No Comments »

As you’ve seen from the discussions about JavaScript and creating the “Hello World” Web Add-in sample, working with non-proprietary programming languages, such as JavaScript, does have at least one advantage: You’re not locked into any particular software to write your code. In order to create VBA code you need the VBA editor, running in an Office application. JavaScript, HTML and CSS can be typed anywhere.

On the other hand, an editor with Intellisense and automatic formatting can save wear-and-tear on your fingers and your nerves! So this post will show you how to write Web Add-ins in a free version of Visual Studio. Read the rest of this entry »

Comments No Comments »

I hope you’re not feeling too intimidated and have been able to create and load the “Hello World” sample

This post takes a closer look at the JavaScript part of the sample. The discussion is in two parts: First, how JavaScript is linked into the HTML page; then, the JavaScript code with the main focus on the Office JS API. Read the rest of this entry »

Comments 3 Comments »

As became apparent in the previous post introducing Web Add-ins, a Web Add-in consists of more than a single file containing the code. Distributing and installing a Web Add-in is more complex than handing someone an Office document containing the code and explaining how to change the settings in the Trust Center so that it can run. Why is this? Read the rest of this entry »

Comments No Comments »

I’m breaking the rhythm of the series on Web Add-ins to report a bug that was discovered by a developer in the VSTO forum, this week. Read the rest of this entry »

Comments No Comments »

My discussion of Web Add-ins will center on Word, since that’s “where I live”. The information on the basics is certainly relevant to other Office applications (Excel and PowerPoint) if the Web Add-in is hosted in a Task Pane – the only kind of Web Add-in Word supports.

So, what all is involved in creating a Web Add-in? Unfortunately, it’s not only JavaScript and the Office JavaScript APIs – that’s just the programming language and object model. At least some knowledge of HTML is required and familiarity with CSS is an advantage. Read the rest of this entry »

Comments 2 Comments »

So, if JavaScript is so mutable, how can the developer be sure what an object actually has in the way of properties and methods? The language provides some properties that return useful information about an object. Read the rest of this entry »

Comments No Comments »

The previous post introduced Objects in JavaScript and showed two ways to declare and populate them. This entry provides more information about what can happen to objects that a VBA developer wouldn’t expect, as well as touch on the topic of variable scope. The reason for covering both in one place is the concern for minimizing unexpected problems and maintaining control of your code. Read the rest of this entry »

Comments No Comments »

Objects as a data type were introduced in a previous post. Now it’s time to look at them in more detail. Read the rest of this entry »

Comments 3 Comments »

Now that you have an idea of the basic JavaScript syntax it’s time to expand from code snippets to more complex subjects, starting with functions. This topic will extend over a number of posts as it’s not quite as simple as what we know from VBA… Read the rest of this entry »

Comments 1 Comment »

In this last post on conditionals and loops I’ll present Arrays and how to loop using the last kind not yet discussed: “For Each”. Read the rest of this entry »

Comments No Comments »

In the third part of working with conditionals we’re going to look at some looping operations. Again, the concept is the same as what’s used in VBA, just different syntax. Read the rest of this entry »

Comments 2 Comments »

Now that you’ve familiarized yourself with the logical operators JavaScript uses it’s time to look at the basic conditional constructs. Looping constructs are the topic of the next post. Read the rest of this entry »

Comments 1 Comment »

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 »

Comments No Comments »

VBA provides useful functions for working with variables of the data types String, Number and (to a lesser extent) Boolean. For example, if you need information from a String you can use Len(), Left(), Mid() and Right() to determine the number of characters in the string, the characters counting from the beginning of the String, from any given position in the String or from the end (right) of the String, respectively.

JavaScript provides much of the same information, sometimes in the form of properties, sometimes in the form of methods (like VBA functions). The names are different from what we’re familiar with in VBA, but the functionality is all there, with some nice additions we’ve sometimes wished for! Read the rest of this entry »

Comments No Comments »

Data types determine what can be done with the content in a variable. For example, Numbers can be manipulated arithmetically; Boolean is used to test a variable’s state: does it or does it not meet a specified criterium.

Two of the data types used in VBA are also found in JavaScript and are used in the same way: String and Boolean.

JavaScript also supports the numerical data type, but in contrast to VBA and most other programming languages there’s only the one: Number. It’s not broken down into various integer and decimal types that exist primarily to limit memory storage requirements. So no need to worry about whether the value you’re assigning to a variable will be Integer or Long, Single or Double! JavaScript just goes whole hog and gives you 64-bit double precision floating point…

Then there are three data types not used in VBA: Read the rest of this entry »

Comments No Comments »

Due to an injury to my horse, I’m spending a lot of time at the stable. It’s much more economic to sit there for a couple of hours rather than drive back-and-forth. To make the most of my time, I try to do some work – learning more about JavaScript – while I’m there. Since I don’t want to lug around the laptop I was looking for a JavaScript IDE for my iPad that works offline and was quite surprised to find one in the App Store: Kodiak JS. Read the rest of this entry »

Comments No Comments »

Up until now, you’ve had to take my word that JavaScript behaves the way I describe. That’s fine, for an article or two, but at some point a developer wants to actually try these things out…

Unlike VB6, VB.NET or C# you can’t create an independent program using JavaScript, by itself. Similarly to VBA it needs to run in a host environment, typically a browser window as part of an HTML page. Of course, if you’re just playing around, setting up an HTML page so that you can see the results of your JavaScript tests is a lot of (too much!) work. What’s more, you’re not going to get much information when things go wrong – for the most part the code will simply stop executing.

So I was very happy when one book I was reading recommended using the “Firebug” add-on for the Mozilla Firefox browser.

This installs into the Firefox browser as a button in the toolbar across the top (circled in red in the screenshot, below). Clicking the button opens a split-pane at the bottom of the browser window. On the right, you type the JavaScript code. When you click on “Run” in the tools across the top of the split-pane the code is executed and the result of the last line is printed. This is similar to using the Immediate Window in the VBA Editor, except you can type lines and lines of code in a normal manner rather than everything having to be on a single line. (Firebug1.png)

Firebug add-on in Firefox

Firebug add-on in Firefox

When you get serious about creating applications, such as a Web Add-in for Word or Excel, then you need a different tool – although this still comes in handy for testing things!

Comments 5 Comments »

When working in VBA it doesn’t matter, for the most part, whether you type capital or small letters. VBA will monitor and compare with its internal list of keywords as well as variables you’ve declared and make corrections as you go. If there are variables that aren’t declared there are no automatic corrections, but VBA doesn’t care. On the whole, you only have to be careful when typing Style names and Find expressions when “Match Case” is in-force. Read the rest of this entry »

Comments No Comments »

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 »

Comments No Comments »

Commenting code is important. JavaScript and C# use the same commenting conventions, which differ somewhat from VBA’s. Comments can be on a single line, similar to VBA; they can also extend across multiple lines: Read the rest of this entry »

Comments No Comments »