MS Word Macros: Two Types and Neither Is Great for Document Assembly
What are MS Word macros?
MS Word Macros is a method by which you can automate a word-processing task that you have to perform repeatedly.
MS Word allows for two types of macros, depending on the complexity of the task:
(1) keystroke macros
(2) scripted macros (Visual Basic for Applications or VBA). While VBA is a powerful scripting platform that allows for conditional logic within macros and is frequently used for building document assembly templates, it, nonetheless, lacks critical functionality for complex document assembly.
What is VBA for Word?
VBA for Word is a term used specifically in reference to the concept of building document automation (document assembly) characteristics into MS Word documents. While VBA in general is a powerful technology and provides a substantial extension to the MS Office suite, VBA for Word, at least in regard to document automation (document assembly), is not the best approach for any enterprise requiring any level of sophistication in its document automation templates.
Why VBA does not work for document assembly
There is a long list of reasons why VBA for Word is not a great choice for this type of programming, and at the top of the list is its intended purpose as a general RAD (Rapid Application Development) platform. Put another way, VBA doesn’t include the document-assembly-specific capability that is essential for enterprise-grade document automation.
For example, let’s say you want to automate the inclusion of correct pronouns that refer to one of the parties in a contract, say the lessee in a lease contract. After writing the specific scripts necessary for this task throughout the Word document, you would then need to go back and write code necessary to generate a question: What is the lessee’s gender? For a single question, this reality may not seem daunting, but for a contract requiring hundreds of discrete data items, custom coding the Q/A interview would represent substantial work that would not be necessary in a true document automation RAD platform, such as HotDocs, which automatically generates a question for each variable in a document template.
Beyond basic information-gathering functionality, VBA has no internal system for saving and managing answer files. VBA doesn’t allow for shared component files among templates, nor does it allow for multi-platform deployment of templates. In other words, a VBA template won’t seamlessly run in a browser, a luxury that HotDocs users have long taken for granted.
One key scripting weakness of VBA for document assembly is its lack of tri-state logic. With document assembly, any number of situations might require conditional logic to be based on not just one of two states—either true or false—but on a third state, which is null or unknown.In other words, if the condition is true, do A. If the condition is false, do B. And if the condition is unknown, do C. In real terms, tri-state logic is critical in situations where a template user may not answer a question at all. In other words, if the question is unanswered, do C.
VBA also lacks many basic scripting features that are commonly needed in the automation of documents. Nested repeat loops, functions necessary for correctly punctuating assembled text, and tri-state logic (the ability to test for unanswered questions in Boolean expressions) are all critical to effectively automating the generation of documents, but are all missing in VBA.
In contrast to VBA, HotDocs, which is a RAD (Rapid Application Development) platform, designed specifically for document automation, easily handles tri-state logic, as well as a variety of other document-automation-specific scripting tasks, such as repeating blocks of text with automated punctuation and composing documents by aggregating and inserting sub documents. HotDocs automatically allows for the storage and reuse of answer files, creates questions for variables used in the document, and allows for a template user to move backward and forward in a template interview . . . And that’s just scratching the surface of features available in HotDocs but not with Word macros.
Want to see document automation software in action?
HotDocs is the market-leading provider of document automation software. Get your free demo today!
Keystroke macros are great for many repetitive tasks. If you happen to have a small handful of simple documents that you want to automate, VBA may work for you. But if your business is heavily dependent on document generation, if your documents have real complexity, and if you don’t happen to have a small army of software engineers sitting around with nothing to do, then VBA is simply the wrong choice.
VBA is a powerful language and dramatically extends the overall functionality of Word. But together, they still don’t come close to the document-assembly-specific functionality in HotDocs.