Chapter 9. Advanced Word Hacks

Introduction: Hacks #80-89

Word is at its best as a word processor—creating, editing, and formatting documents. And with VBA, much of what Word does so well can be automated. But that easy programmability also makes Word capable of much more. The hacks in this chapter show several ways to go above and beyond vanilla VBA, hacking Word into an Emacs clone, a Windows backup utility, and even a fully scriptable tool for generating documents from HTML files.

Emulate Emacs with VBacs

You’ve already learned all those Emacs commands, so you might as well use them. This set of freeware macros replicates many common Emacs keyboard shortcuts within Word.

Emacs, a text editor usually associated with the Unix operating system (though it’s available on most any platform), is in most ways the polar opposite of Word. No one just sits down with Emacs, expecting to hunt around a few menus to find the commands they need. While you can learn simple commands quickly, true Emacs mastery is a lifelong love affair for hackers around the world.

Emacs was born at a time when a window still meant something you opened to let in fresh air. You had to use the keyboard to issue every command, and often they required complex key combinations, such as Ctrl-X, Ctrl-S (the command to save the current file).

Though versions of Emacs have since been developed that include menus and even toolbars, most Emacs users rarely take their hands off the keyboard. So when someone who’s mastered ...

Get Word Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.