For me, the main issue with Word's standard tools was the lack automated row renumbering. There is real value in having consistently numbered rows, but without some sort of renumbering, inserting a row into an existing numbered table of can be a real pain. For example, when creating a list of requirements, I need to add new entries and move items around. I then want the numbering to adjust accordingly.
In some documents, I need to build several lists, so I need the ability to add a prefix to the numbering in each table, so that across the document as a whole, each entry is unique.
Sometimes I need to reliably lock down the numbering in a given table so that new entries don’t automatically change those that already exist. I can then safely renumber the new rows manually.
Appearances matter too, at times I need to use different numbering styles, from the simple (1,2,3,…) to more complex formats such as (A.1, A.2, A.3,...) or (NF-01, NF-02,NF-03…) that involve different sections within a given table, and using different separators, with or without leading zeros.
Word does offer some basic tools for this kind of formatting. For example, it allows you to use outline numbered lists in the first column of a table. I have found these to be tricky to use, especially with prefixes, and it is hard to lock down the numbering at a certain point, so you can be sure that nothing changes.
To address these issues, I decided to write my own one-touch renumbering process.
Inserting and Deleting Improvements
One of my key requirements is the ability to quickly add new rows. I often need to record several new ideas in a table very quickly, for example, when recording workshop findings during rapid discussion.
Word lets you insert lines, but this can require several keystrokes, and you have to be careful how you do it. In Word, it matters whether you insert above or below the current line. I would often get it wrong, and end up with section or heading row formatting copied into the body of the table, and have to use even more keystrokes to correct this.
I decided I needed a one-touch insert function that reliably inserted (say) 5 blank lines below the current line and positioned the cursor ready for rapid entry.
Creating blank lines for quick entry means occasional empty, unused lines. I decided I needed a table clean-up routine to remove unwanted rows before the renumbering started.
Having a one-touch insert function suggested the need for a complementary one-touch delete, something that would delete rows if rows were selected, or regular text if that was selected instead.
Getting Started with the Build.
Microsoft Office comes with a development tool called VBA. You can get started with VBA by having Word record a series of keystrokes and then see how these actions have been converted into VBA code ready for repetitive use. There is a vast amount of information on the web about getting started with VBA, and most BAs will be productive in just an hour or two.
I decided that my table tools would be launched by shortcut keys rather than by using the Ribbon menu. Ribbon coding isn’t for the faint-hearted, and for speed reasons I wanted to keep my fingers on the keyboard as much as possible.
I needed a way of making the tools available to any document without having to load code into each. I found that Word allows you to load a template into its startup folder. This gets opened automatically and allows the code within it to be used by any document. In some environments, this code needs to be digitally signed, but there are simple tools available to self-sign the code for each PC you use.
My first major task was to prove the tools could be invoked correctly. I did this by creating some test routines, assigning them to shortcut keys and confirming I could use them whenever a I needed.
I then tested the basic table manipulation tools in VBA. These included stepping through each row, updating text, deleting rows and similar functions. Word has some quirky ways of marking the end of text in cells, so these tools took a bit of getting used to.
I also needed to store information about the tables. For example, which tables allow renumbering, whether a prefix being used, and what separator should applied. To do this, I decided to use custom document properties, and had to build a set of tools to read these values and update them when they were changed by the user.
The basic routines came together fairly quickly, but I did spend quite a while making the logic handle the wide variety of table manipulation tasks that a BA needs.
I also found that my use of tables really took off when I simplified the text styles I used for tables. I recommend taking the time to set up new styles for standard table text, table bullet points and table headers. Keeping these separate from the regular text styles allows easy change of the fonts to fit the changing cell space availability, and assigning these styles to shortcut keys means they can be used quickly and reliably.
Don't forget to leave your comments below.