Word Macros for Document Production: The Reusable Component Problem
Word macros is a commonly employed technology to automate the production of repetitive documents, a practice commonly referred to by a variety of names, including document assembly, document automation, and document generation. But regardless of the terminology used, Word Macros are not the best choice for automating document production.
Lately, I have written several blog posts on this subject, but my purpose has never been to denigrate Word Macros, VBA, or VSTO, all of which are tremendously powerful technologies for extending the power of MS Office applications. However, the fact is none of these technologies was designed specifically for automating document production. Consequently, none of them includes basic functionality that is absolutely necessary for enterprise-grade document assembly.
One of the most obvious shortcomings of Word Macros (VBA/VSTO) for automated document production has to do with reusable components. For example, let’s say you need to write a script designed to compute a numeric value and merge it into the text of a document. There are many reasons you may need the same script in multiple other places–for example, in the information-gathering dialogue associated with the template, in a related MS Word template, or perhaps even in a related graphical form, such as a PDF file consisting of fields and check boxes.
With Word Macros, VBA, or VSTO, you could, of course, reuse the same script anywhere you wanted, but should the parameters of the script change (the business rules determining the result of the script), you’d have to go to each instance of the script, no matter how many times you used it in no matter how many different files, and update the script manually.
Contrast this reality with the power of HotDocs component files. Once you create a computational component in HotDocs, you could reuse it any number of times in any number of different text or graphical templates. However, if the business rules determining the result of the script changed, you’d only have to modify the original HotDocs component to produce the correct result based on the new rules. Then, wherever the component was used, it would provide the correct result. In other words, instead of updating dozens or even hundreds of files, you’d only have to update one.