In the previous article in this series (part 4) I showed how Microsoft Word can be used to produce a website made up of multiple web pages, and emphasized that Word can do a lot or work for you. However, we can go further by using macros.
Introduction
The use of mail merge as described in the previous article allows us to reduce the number of repetitious tasks in assembling our pages. It also reduces the chances of errors and inconsistencies. One issue it doesn’t deal with is the separation of the merged document into separate web pages. This is in breach of my principle of constructive laziness: “Never do yourself what you can get the computer do for you.”
The Macro Facility in Word
Macros are collections of instructions which are stored in a small program. This can be executed by a keystroke or attached to a menu or toolbar. For those of us allergic to Visual Basic, the easiest way to assemble a macro is to record a sequence of instructions. From experience, the most straightforward, reliable and unambiguous way to do this is through a sequence of keystrokes. Using the mouse can sometimes have unforeseen consequences.
Planning your macro
A macro is like a computer program. It’s always worth thinking in advance about the steps that you need to carry out to achieve your desired purpose.
The steps we wish to automate to separate out our web pages are fairly straightforward.
1. Identify a section of our continuous document that corresponds to a single web page.
2. Select this section
3. Cut it from the continuous document, leaving it in the clipboard.
4. Delete the page break to set up the next section, so that the process can be repeated.
In order to achieve this, we need to know how to achieve each of these steps.
1. Each web page finishes with the