Microsoft Office applications have a powerful programming language built-in, Visual Basic for Applications (VBA). This allows users to write macros to automate tasks and build quite sophisticated add-ins. VBA is easy to learn, but figuring out Word's (for example) object model can be difficult.
Recently I've come across a couple of VBA add-ins aimed at help users to program in VBA.
Code VBA extends VBA's programming environment to make it much easier to find commands and their options. For example, it provides:
- Context sensitive IntelliSense lets you select code from a shortcut menu. Here you may use an existing variable or constant or declare a new variable, select from existing names, obtain property values or call a VBA function that will return a value of the required type. In case of Set(ting) an object variable, it presents all possible sources for you to select from. When you need to specify a condition, it lets you use select using from the above those that return a boolean value and the Condition Builder.
- Starting from an Object, cascading menus move you down the application's object model to apply the required actions: set properties, start methods, loop collections, and so on.
- Tooltips explain what classes and procedures do and give direct access (F1) to the relevant documentation on Office MSDN online. In case of properties of available objects, the actual value is also displayed.
There's much more. Coce VBA is available for all Office versions from 2010 through 2023 and sells for 69 USD per application (with a discounted bundle for the all five Office applications).
Rubberduck is a free and open source IDE add-in for VBA that provides code inspections, annotations, navigation tools, auto-completion, refactoring, unit testing and more. There's also a VBA style guide.
If I were still writing macros for Microsoft Word, I'd probably want both of these tools. As it stands now, if I need a macro I look for it in Paul Beverley's wonderful Macros for Editors collection.
No comments:
Post a Comment