Templates and Macros

To create a template

Open a new Word document, alt+fa to save it (empty) as "Name.dot" (put for "name" whatever you want to call it, and for "save as type" select "document template").

To attach a template to a document

Open the document, click on "tools", "templates and add-ins", "attach", double-click on the name of the template you wish to attach, click "OK", ctrl+S to save the document.

To copy code into a template

Open the document that contains the code, ctrl+A to select all, ctrl+C to copy to clipboard; return to the document to which the template is attached.

Alt+F8 to open the macros dialogue box, for "macro name" type in "zz", if necessary scroll down through the drop-down menu of the "Macros in" box, and select the template into which you want to copy the code, click on "create", ctrl+end to go to the bottom of the code window, ctrl+v to paste in the code from the clipboard, ctrl+s to save. (Ctrl+home to the top of the document, select all the code from Sub zz() to the next End Sub and delete it.)

To run a macro or procedure

Make sure that the relevant template is attached to the document (see above). Alt+F8 to open the macros dialogue box, if necessary scroll down through the drop-down menu for the "Macros in" and select the template you want to use, double-click on the name of the macro you wish to run.

To set up a shortcut key

Open a document to which the relevant template is attached. Click on "Tools", "Customize", "Keyboard", scroll down through the "categories" drop-down menu and select "macros", scroll down through the "save changes in" drop-down menu and select the relevant template. Then click on the name of the macro for which you want to make a shortcut, then click in the "new shortcut key" box and type in the shortcut you want to use. Click on "assign" and "close".