Styles have many wonderful uses, so it behoves any editorial process to use them. We’ve looked at several ways to apply styles, now we’ll look at a macro that will apply several styles in one click!
A common sequence of styles is one for a heading, one for the first paragraph (say, non-indented, perhaps), and then one for a regular paragraph setting that would apply to the remaining paragraphs until the next (sub)heading.
How to Create a Macro to Apply a Sequence of Styles
I put the cursor where I want to start, turn on the “start macro” recording, assign a keyboard shortcut to it, make sure it gets saved in the right template, then apply the style, use the arrow key shortcut to jump to the next para, apply style, jump to next para, apply style, etc., hit “end recording macro” and then save the template, or quit Word, to make sure it gets saved.Editor Madeline Koch shared her smart trick of putting this sequence in a macro.
Sample Multi-Style Macro
In one of Madeline’s recent projects, the macro she created looked like the code below. Note the Style names are particular to her project and not standard options, so this won’t work on your computer unless you create styles with those names first:
Sub GTMapplyEndStyles() ' ' GTMapplyEndStyles Macro ' ' Selection.Style = ActiveDocument.Styles("NAME") Selection.MoveDown Unit:=wdParagraph, Count:=1 Selection.Style = ActiveDocument.Styles("TITLE") Selection.MoveDown Unit:=wdParagraph, Count:=1 Selection.Style = ActiveDocument.Styles("BIO") Selection.MoveDown Unit:=wdParagraph, Count:=1 Selection.Style = ActiveDocument.Styles("TWEET") Selection.MoveDown Unit:=wdParagraph, Count:=1 Selection.Style = ActiveDocument.Styles("WEB") Selection.MoveDown Unit:=wdParagraph, Count:=1 End Sub
Troubleshooting Macro Recording
Always keep a copy of the original file! When making global changes, there’s always some table or list that turns out to have been created in an unsophisticated way and gets messed up by your steps. You’ll want the original to refer back when cleaning up such items.
Work out the sequence of moves for your macro in advance. Test it out on a dummy document or copy of the file before trusting it.
Speed up application of the “subsequent paragraph” style by using an advanced Find and Replace to change all “normal” styling to “subsequent paragraphs” style before you do anything else.
Saving the macro in a template is a great idea, but not necessary.
Don’t use the mouse to select text when recording a macro, use keyboard shortcuts that Word will map, instead:
- Jump down one whole paragraph from the cursor with opt + down arrow. (In Windows: ctrl + down arrow). To jump up one paragraph, use the up arrow! Note that you may have to jump up twice, as the first move takes you only to the top of the current paragraph.
- Don’t press only the arrow keys to move the cursor, as that records the exact number of key presses, which will not work on lines/paragraphs of different lengths. (Occasionally, a heading will run over more than one line.)
Got a gnarly Word problem? Submit your problem and we’ll try to answer it in the new Q&A thread.
Never miss a Word-Wrangling Wednesday tip. Sign up here to get them by email.
By practicing one tip each week, you can invest 13 hours this year into professional development. To search the blog, use the orange bar right above this.
© This blog and all materials in it are copyright Adrienne Montgomerie on the date of publication. All rights reserved. No portion may be stored or distributed without express written permission. Asking is easy!