Awgar Stone - Software Development / Business Applications Oxofrdshire and London, UK
Microsoft Word Customisation and Integration: An Overview (inc. Word Macros, Templates and Word VBA)

Including Microsoft Word Macros and Word VBA

This guide is written with particular emphasis on the legal sector which makes extensive use of Microsoft Word as one of the main tools of it’s trade. Firms produce thousands of documents per day many of which are very long and complex. Advanced document construction and management tools are commonplace.

Microsoft Word still prevails as the leading word processor. Apart from being very good at what it does in terms of easy of use and range of features it is highly customisable and able to be extensively integrated in a variety of ways with many other software and systems.

This article provides an overview and introduction to the reasons for, possibilities and techniques available for integration and customisation of Microsoft Word with a view to encouraging more awareness of the possibilities offered by this powerful tool.

Do We Need MS Word and Documents These Days?

Isn’t everything best on the web? Well, not really, not yet. At least in the UK a physical signature is necessary legally fro a start. Also creating and formatting complex documents is easier with Microsoft Word due to it’s mature features and add-ons / companion tools such as HotDocs. There are also countless bespoke solutions based on Microsoft Word (most large law firms for a start) and it’s various (extensive) methods of customisation and integration which are both advanced and mature. It is possibly for this reason (so many solutions and system are already being based on it) that Microsoft Word, like Excel and Windows, is probably here to stay for a good while longer and why Open Office, Google Docs (and Linux for that matter) although perfectly good tools have not taken over yet or even really taken off, not for small business and certainly not for mid-large business.

Things are slowly changing and work is being done particularly at the larger law firms in the direction of enterprise content management merging traditional document management with web-style content management and technologies such as ASP.NET and CSS.

Why Customise / Integrate Microsoft Word?

As with most IT solutions to automate manual, repetitive processes and save time and money. In a large law firm for example, often just a few clicks can create a perfect, standard, error-free document. Even complex legal documents can be constructed rapidly and accurately. End-to-end solutions are possible such as remote document production and printing (several copies on the correct paper with watermark) triggered by an email for example from a property sale.

How Can Microsoft Word be Customised / Integrated?

  • create new toolbar buttons and menu items
  • create custom dialog boxes that do new things
  • get from or send data to other programs, databases, files or the internet
  • create new templates
  • automated by document production programmes such as HotDocs or case / practice management systems such as Amicus Attorney
  • integrated with document management software such as OpenDocs or Interwoven (version management is possible here too)

Examples

  • Automatically printing a document to the correct printer, tray and paper type based on the document type, with watermarking included.
  • Triggering of document construction and possibly printing via remote means e.g. web site, email or other.
  • Faster, part-automated document production to prevent errors, reuse existing company data and produce consistent highly professional documents.
  • Document management - automatic storage and retrieval of documents as well as version management.
  • Automatic style / formatting management.
  • Pagination, footer text, paragraph / sentence reuse and other bespoke time-saving utilities as well as template-driven document production (start off with a part-made document including logo and non-content text etc.)
  • Integration with other systems which may hold e.g. customer information that can be accessed to produce documents in Word, may use Word to produce reports or Word may route documents to it (e.g. to Outlook). Applications to integrate with include (but are not limited to) enterprise content management systems, case management system, accounts packages, bespoke application, document management systems, document production systems, email systems, websites.

Customisation Techniques

Technically how does one go about customising or integrating Microsoft Word? There are many options:
  • templates
  • Microsoft Word macros
  • Word VBA (Visual Basic for Applications)
  • automation
  • COM add-ins
  • embedded COM objects
  • DDE
  • WLL

Templates

When you create a new document you can be presented with various templates (i.e. part-started documents) rather than just “Blank”, e.g. a letter template specific to your firm. Simply save a document as a template to the workgroup or templates folder (see Options > File Locations to find out where that is) and it appears as a template when New is selected.

Using VBA (see below) you can even have a box pop up on creation of a template asking pertinent questions regarding the content details and even suck information from Outlook for example.

Microsoft Word Macros

Accessible to almost anyone, macros can speed up manual tasks within Word. Basically you can record what you do and play it back whenever you like at the click of a button. Simply look up Macro in the Help and your version of Word will tell you what to do.

Microsoft Word Macros are used a lot in the legal sector as a casual way to automate repetitive tasks. They could be used more however as they are a simply but powerful time-saving tool. More training for all levels of staff would probably be worth it.

You can create a new toolbar button and assign the macro to it so it is fired when pressed. Right-click the menu for options to do this.

Word VBA

Not many people know about Microsoft Word VBA. It is used heavily in law firms but mainly by the IT department, mainly the in-house developers, which is probably for the best as it is quite complex. Often tools or add-ins to Word consist of VBA.

What is VBA? It is a little known fact that Microsoft Word contains within it a full, powerful software development environment, able to customise Word in almost any way you could imagine. Complete new features can be added to Word, links to other software can be created and managed. You can even turn the monitor off or shut the PC down. Anyway, this environment is refered to as VBA and so is the language of the code you write to do these fantastic customisations.

To access the Microsoft Word VBA development environment press Alt+F11 in Word.

With VBA you can add toolbar buttons and menu items, change existing features such as saving or printing, automate other programs and almost anything else.

Automation

This is the control of Word from another program which may be bespoke software. For example a report may be constructed in a new Word document and the info squirted in to it from an application and formatting applied. All very convenient and powerful. You could even automate Word from Excel or Outlook.

COM Add-ins

Similar in functionality to VBA but the source code can’t be changed. More long-winded to make as requires a development environment such as Visual Studio (proper software development basically). Faster than VBA in terms of code execution but slower to develop (VBA is more tightly integrated to Word).

Many add-ins are available for purchase over the internet, it’s worth having a search to be aware of what is availabe to prevent re-invention of the wheel.

Smart Tags

A relatively new feature, these are the options that appear above certain words in a document offering various relevant options. This feature is completely customisable but like COM add-ins requires “proper” software development, typically Visual Studio and C# is used.

Embedded COM Objects

Slightly obscure inclusion this one but worth a mention. Registered COM objects can be inserted into a Word document via the menus the same way as a picture for example. You could write your own COM object. If you wanted to.

DDE

Very fast method of communication between programs and Word uses it too. Microsoft don’t like to mention it and describe it as legacy but it is used (e.g. banks use it in Excel a lot too). If you’re a programmer make yourself a DDE server and client to see how it works. If you’re not, look into the file types dialog box in Windows Explorer and investigate, you should stumble across some DDE. Google for more info.

WLL

Very obscure. Special DLL that Word picks up. Still worked when I last checked. Not really mentioned much these days by Microsoft or anyone really. Not sure why you’d want to make one.

Can Excel be Customised like this Too?

Yes, pretty much the same things can be done. The details differ slightly, but the possibilities are broadly the same. The same goes for the rest of Microsoft Office, though the others are more limited than Word and Excel and Access is quite different.


--
26 June 2010
Paul Rigby is director and software developer at Awgar Stone Ltd. and has been producing enterprise-grade IT solutions based around Microsoft Word, Outlook and Excel for many of the UK’s leading law firms since 2001.


Interested in similar software or would just like more information?

If so fill in the form below and press send.


Your email address:
What you would like:
Sign up to newsletter: