Access Lunchtime – Deep Dive into Word Automation using VBA and Access

Come join us on the last Tuesday of every month @ 12 noon CDT.  Maria Barnes will be your host and we will cover lots of interesting topics related to Microsoft AEventsccess.  This is a free webinar for 1 hour, we look forward to meeting you!


The presenter will be Crystal Long.  She has been using and developing with Access a long time, and Word even longer since it was available in the DOS days. She connects 1-on-1 and guides developers as they’re building applications, and teaches in virtual classrooms.  On her website,, you can find free code, tools, videos, and articles. On her YouTube channel, LearnAccessByCrystal, you’ll find lots of Access videos and some about other Office topics. On forums, she is ‘strive4peace’. She is also a long-time Access MVP.


She will cover the following:
Create professional Word documents from scratch using Word Automation. This is a deep dive into code to write data and text, format, save, and open the finished document with VBA.

We often want to make datasheets look nicer and have many of them in one report. A great way to do this is by creating a Word document with lots of pages and tables.

For each Word table, open a recordset in Access, determine how many rows and columns it has, and create a table in Word that size, with an extra row to be a shaded heading row. Set column widths depending on the table type.

Loop through the recordset and write information to cells, one record and field at a time. Reference any cell in the table by row and column. Format all or any text according to where or what it is.

Learn what objects are handy to dimension and set. While developing, use early-binding and reference the Microsoft Word #.# Object Library. As you write VBA and have advantage of Intellisense, comment and convert constants to values, and write and comment late-binding object declarations to use for deployment.

Write and format text in paragraphs, tables, headers, bookmarks, captions, and hyperlinks. Put tables in cells of tables. Insert and position images.

Create and use paragraph and character styles. Use wildcards in Find/Replace to replace phrases that match a pattern such as being enclosed with parentheses with a particular character style to make many changes at once.

In a sense, we are always working with a range of the document — whether it’s the whole document or just part of it like a table, a cell, a paragraph, some text in the middle of something, …. Learn how to use and set ranges.

For internal links within a document, set bookmarks to reference from somewhere else. Add a hyperlink that goes to a bookmark in the document and set the text to display.

Create lists such as a List of Tables with hyperlinks showing table number, caption, and page number.

Create a Table of Contents with hyperlinks using built-in Heading style references such as Heading 1, Heading 2, and Heading 3.

Define a header that will show at the top of every page. To make the content dynamic, insert text from styles such as Heading 1 and Heading 2, and fields such as date, page number and number of pages.

Use the PageSetup object to set margins. Optionally, set other properties like orientation, gutters, designate odd and even pages, and paper size.

When all is done, save the document, clean up object variables, and open a folder to files or the new document itself.

Get a sample Access database with VBA to create Word documents that enumerate Fonts installed in Windows, Word’s built-in Styles, and create documents with information from tables, and insert images from path\files stored in Access. A folder of sample images will also be provided.


We meet every last Tuesday of the month at 12 noon CDT.

To join our meeting, please use the following link and phone number or use your computer’s speakers with audio:

Join Zoom Meeting

Meeting ID: 912 8399 7040
Passcode: 245440
One tap mobile
+19294362866,,91283997040#,,,,*245440# US (New York)
+13017158592,,91283997040#,,,,*245440# US (Washington DC)

Dial by your location
+1 929 436 2866 US (New York)
+1 301 715 8592 US (Washington DC)
+1 312 626 6799 US (Chicago)
+1 669 900 6833 US (San Jose)
+1 253 215 8782 US (Tacoma)
+1 346 248 7799 US (Houston)

Meeting ID: 912 8399 7040
Passcode: 245440
Find your local number: