If you don’t know the VBA syntax for an operation, you can record a Word macro to
create a procedure containing the code, though you may have to trim out the excess —
recorded macros generally set every single argument of a method, whether or not they are needed.
The finished contact list document is shown in Figure 2.1.
FIGURE 2.1
A Word document filled with Access data using the TypeText method.
Using Word Templates for Creating Formatted Word Documents........................................
The TypeTextmethod used in the previous section is only suitable for creating very simple Word
documents. If you need to produce fully formatted Word documents, with headers, footers, and
sections with different margins, or if you need to place Access data at various points within blocks
of text, it’s best to prepare one or more Word templates in advance, formatting them as needed.
Then you can create new documents from the templates and fill them with Access data as needed,
using either bookmarks or (my preferred method) Word document properties.
The first step is to create the Word templates, with headers, footers, logo, and different fonts as
needed. Depending on the method you want to use, either place bookmarks in the template where
you want the Access data to appear or create document properties to accept the Access data, and
place DocProperty fields in the template where you want the Access data to appear.
TIPTIP
Part I The Office Components and What They Do Best