The Macro Zone

VBA in Microsoft Word for Windows

 Templates available for download
(and other stuff)

Use the VBA macro code in these templates to learn how to solve problems for yourself. Most of the templates contain text that explains how the macros work, and the macros themselves contain comments.

Unless indicated otherwise, the macros in these templates work in Word 2000 through Word 2021 and Word from Microsoft Office 365. Some specify that they're for Word 2000 to 2003 only, while others say they're for use only in Word 2007 and later, or other specific versions.

Most of the templates should be stored in your Templates folder and used to create new documents. The few that are add-ins explicitly refer to the instructions for storing them in Word's STARTUP folder.

Controlling the Printer from Word VBA An article from 2002-2003 by MVP Jonathan West that explains how to program VBA macros to get information from printers and send commands to printers. This is the most comprehensive article on the topic. I retrieved it from the Internet Archive Wayback Machine.

PrinterControl.zip An add-in that prints both a full-color copy of the current document and a black-and-white copy with a single click of a button on the Quick Access Toolbar. It is an example of updating existing 32-bit code to 64-bit compatibility, using the code from the "Controlling the Printer" document (above) as the basis. To install the add-in, follow the instructions below under "SaveView2013.zip".

Stop Reconfiguring Two or More Versions of Word on the Same Computer If you have two or more versions installed, each one wants to reconfigure after you run another one. This article explains how to stop that, without manually editing the registry.

2024_Calendars.zip Word Templates for 12-month calendars for 2024, in both Word 97-2003 (*.dot) and Word 2007-2019 (*.dotx) format. Also available: 2024_Calendar_portrait.zip in portrait format as a .docx file.

2025_Calendars.zip Word Templates for 12-month calendars for 2025, in both Word 97-2003 (*.dot) and Word 2007-2019 (*.dotx) format. Also includes a 2025 calendar in portrait format as a .docx file.

AutoCorrect2007.zip The AutoCorrect backup/restore template from the Word MVP FAQ, updated for use with Word 2007 and later. Thanks to MVP Graham Mayor for improvements, including a progress bar and elimination of "not responding" states. Fixed to work in Word when the default language is not English. New: If you edit the backup document to remove entries from the table, those entries will be deleted from the AutoCorrect list. Find additional information about this tool in Lewis D. Eigen's posts of March 4, 2018 at this page and August 10, 2018 at this page.

AutoCorrectWithMath.zip New November 2024 Same as the AutoCorrect2007 template above, but expanded to include backup/restore of Math AutoCorrect entries.

autotextdumper.zip Utility for dumping all AutoText entries from a template to a document. Word 2000–2003 only.

autotextloader2.zip Utility for loading a large number of AutoText entries into a template. Word 2000–2003 only.

bookmark_addin.zip An add-in that displays on the status bar the name of any bookmark that you select. Works in all versions. To install it, follow the instructions below under "SaveView2013.zip".

finder.zip Revised November 2019 A Find dialog like the one in Adobe Reader, showing all occurrences of a term. The zip file contains both .dot and .dotm files. The .dot file works in all versions from Word 2000 to 2019 and Office 365. The .dotm file works in Word 2007 and later, and includes a Find button on the Home ribbon. Thanks to Graham Mayor for making the Finder dialog nonmodal (you can go back and forth between the dialog and the document body) and for adding the ribbon button.

form_picture.zip Demo of a method for inserting a picture into a locked form.
If you use table cells to hold the pictures, the pictures will be automatically resized to fit the cells. Different pictures can be inserted at different sizes.

goto_endnote.zip An add-in that enables you to specify the section and number of an endnote to go to, in a document where the endnote numbers restart at 1 in each section. To install it, follow the instructions below under "SaveView2013.zip".

NewDocUserform.zip Revised July 2017 An add-in that displays a New Document dialog in the efficient List format. You can choose to show the templates in any folder, including network locations. This is especially useful to replace the huge File > New page in Word 2013 and later, but it also works in Word 2007 and 2010. It adds a button to the Quick Access Toolbar. The revised version remembers the selected folder until you change it or close Word. To install the add-in, follow the instructions below under "SaveView2013.zip".

SaveViewLocMulti.zip or SaveViewLocMulti_2007-2010.zip An add-in that reopens each window of a document in the same screen location (including on multiple monitors), with the same window size, view, zoom, and position in the document as it had when it was last saved. This add-in supersedes both SaveView2013 and SaveLocation. UPDATED 11 March 2020 to create a separate add-in for Word 2007 and 2010 (use only the add-in that corresponds to your version of Word!). UPDATED 2 JANUARY 2021 to add control of the size and position of the Navigation pane. UPDATED 7 DECEMBER 2023 to add control of which reviewers are shown for tracked changes and comments (not in the 2007-2010 version). To install either version, follow the instructions below under "SaveView2013.zip".

SaveLocation.zip An add-in that reopens each document in the same screen location (including on multiple monitors) and the same window size as it had when it was last saved. It isn't necessary if you install SaveViewLocMulti.

SaveView2013.zip Word 2013 and later versions force all documents to open in Print Layout view. This add-in restores the behavior of previous versions, saving the current view and zoom in the file and showing that view when you reopen the document. Includes Graham Mayor's contribution here. It isn't necessary if you install SaveViewLocMulti.

  Instructions for installing template add-ins: Right-click the downloaded zip file, click Properties, and click the Unblock button; then click OK. Extract the .dotm file from the zip file. In Windows Explorer, type or paste the following expression into the address bar and then press Enter:

  %appdata%\Microsoft\Word\STARTUP

Paste the .dotm file into that folder. If Word is running, close it and reopen it.

EQ field switches This is a copy of the "EQ field switches" page from the Word 2003 Help file. It seems that this information is no longer available on the Microsoft web site, and copies I've found elsewhere are incomplete.

WordBasic Help file This exe file installs the Help from Word 95 WordBasic. You need this reference if you're converting an old macro.

zip_to_city.zip Demo of a method for inserting a zip code list in a userform.