Lyonizing Word: But Wait—There’s More!

by Jack Lyon

Replacing Basic Text

Searching with wildcards in Microsoft Word can accomplish miracles in editing, but some people find wildcards a little too arcane to deal with. If you’re one of those people, you might benefit from some of Word’s lesser-known but easier-to-use search options. But first, let’s do a basic find and replace. Open Word’s “Find and Replace” dialog by pressing CTRL + H (or click Home > Editing > Replace on Word’s ribbon interface). Then:

  1. In the “Find what” box, enter a word you want to search for. (We’ll use the misspelled “millenium” as an example.)
  2. In the “Replace with” box, enter a word you want to replace the incorrectly spelled “millenium” with. (We’ll use the correctly spelled “millennium” as an example.)
  3. Click the “Replace All” button.
Find & Replace

Find & Replace

That’s it. Every occurrence of “millenium” will be replaced with “millennium.” Simple and quick.

Refining Your Search

But wait—there’s more! Microsoft Word provides many ways to refine your search. See the “More” button at the bottom of the “Replace” dialog?

More Button

More Button

Click it. Here’s what you’ll see:

The "More" Options

The "More" Options

Under “Search Options,” you can specify whether to search up, down, or through all your text:

Search Options

Search Options

You can also match case and find whole words only:

Additional Options

Additional Options

There are actually lots of options, all worth exploring:

Match case

Obviously, this option finds only text that matches the case (capitalized or lowercased) of the text in the “Find what” box. If you enter “Hello” in the “Find what” box with “Match case” checked, Word finds “Hello” but not “hello.” If you enter “hello,” Word finds “hello” but not “Hello.”

Find whole words only

This option finds whole words only. For example, if you search for “sing,” Word finds “sing” but not “singing.” If this option is not checked, Word finds both “sing” and “singing,” as well as “using” and “kissing.”

Use wildcards

This option tells Word that you want to search using wildcards:

Use Wildcards

Use Wildcards

Wildcards are important, but in this article we’re trying to avoid these. For explanations and examples, see my past articles (e.g., Lyonizing Word: From Easy to Impossible — Three Variations on a Theme, Lyonizing Word: The Easy Way, Not So Easy, Lyonizing Word: The Easy Way, Not So Easy, and Lyonizing Word: We Can Do This the Easy Way, or . . . ; if you use EditTools, see The Business of Editing: Wildcarding for Dollars). Please note, however, that if this option is checked, you can no longer select “Match case” or “Find whole words only.” Even so, during a wildcard search, “Match case” is automatically enabled, even though it’s not shown as enabled (an oversight on Microsoft’s part). “Find whole words only,” on the other hand, is inactive.

Sounds like (English)

This option finds words that sound like the word in the “Find what” box. For example, if you search for “cot,” Word also finds “caught.” If you search for “horse,” Word also finds “hoarse.” This could be useful if you’re working on a document in which certain words have been confused or mistyped. Basically, this feature works on words that are homophones; it doesn’t seem to work on words that sound almost alike, such as “horse” and “whores.” On the other hand, while searching for “horse,” it also finds “horsey” but not “horses,” so who knows?

Find all word forms (English)

This option finds what Microsoft calls “all” forms of the word in the “Find what” box. For example, if you search for “sit,” Word also finds “sat” and “sitting.” The word “all” is a little misleading, however. The feature relies on an underlying database of word forms that is pretty good but has some omissions. For example, if you search for “eat,” Word finds “eat, “ate,” “eaten,” and “eating” but not “eater.” Similarly, if you search for “horse,” Word finds “horse,” “horses,” and “horsing” but not “horseless.” It’s a useful feature, mostly for finding verb forms; just don’t expect it to actually find all forms of a word.

Match prefix

This option matches words beginning with the search string. For example, if you put “pre” in the “Find what” box, Word finds “prepare,” “present,” and so on. This isn’t a “smart” feature; it searches for characters only, not word roots. For example, searching for “pre” also finds “prestidigitation” and “pressure,” even though “pre” isn’t really a prefix in those words.

Match suffix

This option matches words ending with the search string. For example, if you put “ing” in the “Find what” box, Word finds “singing,” “typing,” and so on. This isn’t a “smart” feature; it searches for characters only, not word roots. For example, searching for “ing” also finds “boing,” “spring,” and “thing,” even though “ing” isn’t really a suffix in those words.

Ignore punctuation characters

Ignores punctuation characters between words. For example, “trees plants and flowers” finds “trees, plants, and flowers” as well as “trees plants and flowers.” This might be useful for fixing problems with serial commas.

Ignore white-space characters

Ignores all white space (spaces, tabs, and so on) between words. For example, “webpage” finds “web page” as well as “webpage.” This is the inverse of “Find whole words only” and could be useful for fixing words that are sometimes spelled open and sometimes closed.

Other options

If you’re working in a language other than English, other options may be available, including Match Kashida, Match Diacritics, Match Alef Hamza, and Match Control. I know almost nothing about these options, so I can’t comment on them with any degree of expertise.

Format

One of the most important tools in Microsoft Word’s find and replace toolbox is the ability to search for formatting — all kinds of formatting. To do so, click the “Format” button:

Format Button

Format Button

Here’s what you’ll get:

The "Format" Options

The "Format" Options

Each option (such as “Font”) opens the usual dialog for that feature:

Font Format Options

Font Format Options

I won’t go into all of the options in these dialogs as they’re basically the same ones you’d get while formatting any text in Word. “Font” displays font options, “Styles” displays styles, and so on. You can select any of those options and use them as something to find or replace. For example, if your cursor is in the “Find what” box and you select “Italic” in the “Find Font” dialog, here’s what you’ll get:

Displaying the Font Option Choice

Displaying the Font Option Choice

Now Word will find text in italics but not in roman. If you also enter a word, you’ll find that word in italic but not in roman. If you don’t enter a word, you’ll find anything formatted as italic.

But what about the “Replace with” box? What happens if you use formatting there?

If the “Replace with” box includes some text, whatever is found will be replaced by that text in the format you specified. If the “Replace with” box doesn’t include text, whatever is found will be replaced with itself in the format you specified. For example, if you search for the word “apples” to be replaced by “pears” in bold, that’s exactly what you’ll get — “pears” in bold. If you search for the word “apples” to be replaced by bold alone (with no text), you’ll get “apples” in bold.

If, on the other hand, you search for “apples” but don’t specify text or formatting in the “Replace with” box, “apples” will be replaced with nothing; in other words, it will be deleted.

Many variations are possible. Here’s a basic summary:

Find Replace Result
apples pears pears
apples pears [bold] pears [bold]
apples [bold] apples [bold]
apples [nothing] [apples deleted]
[bold] [nothing] [bold text deleted]
[bold] pears [bold text becomes “pears” in bold]
[bold] pears [italic] [bold text becomes “pears” in bold italic]
[bold] [italic] [bold text becomes bold italic]

Note that you can also specify not a certain kind of formatting, such as “not bold” or “not italic” in either find or replace. You can also use combinations of formatting (and “not” formatting). For example, you can search for bold but replace with italic and not bold, which will turn any bold text into italic (but not bold italic) text.

Built-In Codes

In addition to all of those options, Microsoft Word includes lots of built-in find-and-replace codes that are not wildcards (although lots of people call them that). You can use these built-in codes to search for things like paragraph breaks, tabs, section breaks, column breaks, dashes, footnotes, endnotes, graphics, and many other things that aren’t actual text, and codes are a whole lot easier to use than wildcards. In fact, codes should be your default tool; you should use wildcards only when built-in codes won’t do what you need (which is actually fairly often, unfortunately).

Some of Word’s built-in codes can be used only in the “Find what” box; others can be used only in the “Replace with” box. Some of the codes can be used in both boxes.

“Find What” Codes

To see the codes that can be used in the “Find what” box, put your cursor in the box. Now click the “Special” button at the bottom of the “Find and Replace” dialog.

The "Special" Button

The "Special" Button

You’ll get a list like this:

The "Special" Options

The "Special" Options

Identify the item you want to find and click it, for example, “Paragraph Mark.” You’ll get the following code in the “Find what” box (since that’s where your cursor was located):

^p

That tells Word to find a paragraph break — that is, the end of a paragraph.

Each item on the list will insert a different code. For example, here’s the code for an em dash:

^+

And here’s the code for an en dash:

^=

“Replace With” Codes

Now put your cursor in the “Replace with” box and click the “Special” button again. This time, you’ll get a different list:

The Codes

The "Replace with" List

Again, clicking one of the list items will insert a code into the “Replace with” box. For example, if you click “Clipboard Contents” you’ll get this:

^c

That’s an extremely useful code, because ordinarily the “Replace with” box can hold no more than 255 characters. But using the ^c code, you can replace with anything that is currently copied to the Clipboard, which can hold many pages of text, graphics, or anything else.

After you’ve worked with built-in codes for a while, you’ll find it easy to just type them in by hand. In the meantime, you can use the “Special” lists to insert them.

You can also use combinations of codes. For example, you could search for tabs followed by paragraph breaks (^t^p) and replace them with paragraph breaks alone (^p).

Here’s a summary of Word’s built-in codes and where they can be used:

Character or object Find what Replace with
Annotation Mark (comment) ^a
Any character ^?
Any digit ^#
Any letter ^$
Caret character ^^ ^^
Clipboard contents ^c
Column break ^n ^n
“Find what text” (whatever was found during your search) ^&
Em dash ^+ ^+
En dash ^= ^=
Endnote mark ^e
Field ^d
Footnote mark ^f
Graphic ^g
Line break ^l ^l
Manual page break ^m ^m
Nonbreaking hyphen ^~ ^~
Nonbreaking space ^s ^s
Optional hyphen ^- ^-
Paragraph mark ^p ^p
Section break ^b
Tab character ^t ^t
White space ^w

Even without wildcards, Microsoft Word’s find and replace features can do an awful lot — much more than you might think. You probably already knew how to use “Match case” and “Find whole words only,” but did you know about those other options? “Ignore punctuation characters” and “Ignore white-space characters,” for example, can be very useful in editing. Being able to find and replace formatting is essential, especially when using styles. And using Word’s built-in codes lets you search for all kinds of things (graphics, page breaks, dashes, and so on) that would otherwise require more advanced techniques (like wildcards and numeric codes). In other words, Microsoft Word’s basic find and replace features aren’t so basic — at least not in what they can do!

Wildcard Cookbook

This article is a slightly modified excerpt from my new book, Wildcard Cookbook for Microsoft Word, now available at Barnes & Noble, Amazon, and other fine bookstores:

"Wildcard Cookbook" by Jack Lyon

"Wildcard Cookbook" by Jack Lyon

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

 

Lyonizing Word: Assigning Macro Shortcut Keys

by Jack Lyon

I recently had the pleasure of doing an interview for the Chicago Manual of Style “Shop Talk” column. In the interview, I explained how to record a simple macro for transposing characters while editing.

After reading the interview, editor Kristi Hein commented:

Terrific. Next, please discuss the process of choosing a keystroke combination for your macro: not using one of the many you’ve already assigned, making it a combo that’s not too convoluted for the hands (defeating the purpose somewhat), and that you will remember among all the other keystroke combinations you’ve assigned. Therein lies the true art of automating Word effectively and efficiently.

Kristi is right, but wow, that’s a tall order. Let’s look at each requirement separately.

Not using one of the many we’ve already assigned

To not use one of the many keyboard combinations already assigned, we need to know the keystroke combinations we’ve already assigned. Here’s how to do that:

  1. Click CTRL + P to open Word’s “Print” dialog.
  2. Under “Settings,” click the dropdown list that begins with “Print All Pages.”
  3. Under “Document Properties,” click “Key Assignments.” (Also, notice the other things you might want to print, such as styles and AutoText entries.)
  4. Click the “Print” button.

You’ll get a nicely formatted document that shows all of your existing key combinations. The entries will look something like this, with the key combinations on the left and the macro names on the right:

Alt+Ctrl+Shift+S — Normal.NewMacros.ChangeStyleBasedOn
Alt+Ctrl+Shift+I — Normal.NewMacros.CheckIndexCodes
Alt+Ctrl+Shift+C — Normal.NewMacros.FixCodes
Alt+Ctrl+Shift+M — Normal.NewMacros.ParseMetadata

“And how do I assign key combinations to begin with?” you’re wondering. There are (at least) a couple of ways:

When you go to record a new macro (under View > Macro), one of your options is to assign a key combination by pressing the “Keyboard” button:

Using the keyboard option

Using the keyboard option

When you do that, you’ll see the following dialog:

The dialog for entering the key combination

The dialog for entering the key combination

If you were working with an existing macro (editing rather than recording), you’d see any existing key combinations under “Current keys.” To assign a new combination, put your cursor in the box labeled “Press new shortcut key” and, well, press a new shortcut key.

If the new key is already assigned to a macro, you’ll get a “Currently assigned to” message like this:

Currently assigned message

Currently assigned message

That’s handy because it helps you avoid accidentally overwriting a combination that you’ve already assigned (although you can overwrite one on purpose). If you don’t get that message, you’re good to go, and you can click the “Assign” button (on the lower left) and then the “Close” button (on the lower right) and then record the keystrokes that will make up your macro. (When you’re finished recording, click View > Macro > Stop Recording.)

If you want to assign a key combination to an existing macro, things get a little more complicated:

  1. Click “File > Options.”
  2. Click the “Customize Ribbon” button (on the left).
  3. Under “Choose commands from,” select “Macros” (unless you want to use one of Word’s built-in commands, which you can also do).
  4. At the bottom of the dialog, you’ll see “Keyboard shortcuts: Customize.” Click the “Customize” button and proceed as explained above.
Customizing

Customizing

But to continue…

Making it a combo that’s not too convoluted for the hands

This, of course, depends on how many fingers you have (I have ten so far) and how large or small they are, along with your native dexterity. As you can see in the picture above, I’m partial to ALT + CTRL + SHIFT, which I actually find easy to press with my left hand while pressing a letter key with my right. If that’s too convoluted for you, you might try CTRL + SHIFT or CTRL + ALT, both of which are easy to do. ALT + SHIFT is a little more difficult. You can even use plain old CTRL or ALT with another character, but that starts to encroach on Word’s built-in key combinations (like CTRL + S to save a document).

There’s another system, however, that you may not know about:

  1. Press your desired key combination.
  2. Press another key.

The result will be something like this:

Two-step key

Two-step key

See that ,”1” after the “Alt+Ctrl+Shift+M”? That means I’ve just created a two-step key combination. To run the macro, I press ALT+CTRL+SHIFT+M. Then I press 1 (the one key, all by itself). At that point (and not before), the macro will run. Pretty slick!

What that means is that you can assign all kinds of two-step combinations (letters will work as well as numbers), which gives you two characters for the mnemonic you use to remember what a combination does. That’s twice as good as one! (Unfortunately, Word won’t let you use more than two.) It also means you can create shortcuts like these:

ALT+CTRL+SHIFT+H,1 (to apply the Heading 1 style)ALT+CTRL+SHIFT+H,2 (to apply the Heading 2 style)

Or these:

CTRL + SHIFT + T,C (to transpose characters)
CTRL + SHIFT + T,W (to transpose words)
CTRL + SHIFT + T,S (to transpose sentences)
CTRL + SHIFT + T,P (to transpose paragraphs)

And so on. The mind reels at the possibilities!

Making it a combo that you will remember among all the other keystroke combinations you’ve assigned

Using two-step combinations should help with that requirement as well, but for serious keyboard junkies there’s another solution — XKeys. The company manufactures various models, from 24 keys on up to 128 keys! You can assign the keys to your macros, label the keys, color code them, and so on. The 60-key model looks like this:

The 60-key XKeys

The 60-key XKeys

Rich Adin swears by this gadget, and he’s one of the most productive copyeditors I know. Maybe you’d find it useful too.

We've met the requirements

In summary, we’ve figured out some ways to meet all of Kristi Hein’s requirements for key combinations:

  • Not using one of the many you’ve already assigned.
  • Making it a combo that’s not too convoluted for the hands.
  • Making it a combo that you will remember among all the other keystroke combinations you’ve assigned.

These may seem like small things, but small things add up to greater editing efficiency, and that means more money in your pocket and less time at work, both of which are big things. I hope this essay will help you achieve them.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Lyonizing Word: The Easy Way, Not So Easy

by Jack Lyon

After publishing my last article, Lyonizing Word: We Can Do This the Easy Way, or . . ., Rich Adin, An American Editor, wrote:

As written, your wildcard find and replace reduces four names to three if “et al:” is the ending characteristic. How do you write it so that it can handle any number of names, say up to seven?

Good question, and a nice challenge for a wildcard search. Let’s say we have citations with strings of names like this:

Lyon J, Adin R, Carter TO, Jackson TT, Doe J, Smith K, Winger W, et al: blah blah blah

That’s seven names, but let’s see if we can make a wildcard string that will find any number of names and cut them down to three. My first impression is that this might be difficult or even impossible. But let’s try the following wildcard string:

([!^013]@, ){3}([!^013]@, ){1,}(et al:)

Here’s what that means:

Find any character except a carriage return: [!^013]
repeated any number of times: @
followed by a comma
followed by a space
and enclosed in parentheses to form a “group.”
Do that three times in a row: {3}
Find using the same group: ([!^013]@, )
if it occurs once or more (as indicated by the comma): {1,}
followed by “et al:” in parentheses to form a group.

There’s just one problem: It doesn’t work. And that’s how it often is with wildcards — sometimes you have to fiddle around to get the result you want; trial and error are key. So let’s see if we can find just three instances of text using our group:

([!^013]@, ){3}

That doesn’t work either. What in the world is going on here? Let’s try using the group three times in a row:

([!^013]@, )([!^013]@, )([!^013]@, )

That does work. So why not this?

([!^013]@, ){3}

Could it be that {3} doesn’t apply to the wildcard pattern ([!^013]@, ) itself but to the first instance of text that pattern finds? In other words, would that wildcard string  find the first three names in a citation like the following?

Lyon J, Lyon J, Lyon J, Lyon J, Lyon J, Lyon J, Lyon J, et al: blah blah blah

Sure enough, that works! So we’ve just learned something new about wildcard searches. For clarity, I’ll restate it here:

Specifying how many times to find something (using {3}, for example) doesn’t apply to the wildcard pattern it follows but to the first instance of text that pattern finds.

Unfortunately, that means we need to work out a different approach to our original problem. How about this?

([!^013]@, [!^013]@, [!^013]@, )([!^013]@, ){1,}(et al:)

Here’s what that means:

Find any character except a carriage return: [!^013]
repeated any number of times: @
followed by a comma
followed by a space
repeated three times
and enclosed in parentheses to form a “group.”
Find using the same group: ([!^013]@, )
if it occurs once or more (as indicated by the comma): {1,}
followed by “et al:” in parentheses to form a group.

But no, that doesn’t work either! Why not? Oh, yeah, because of that {1,}. As we discovered earlier:

Specifying how many times to find something (using {3}, for example) doesn’t apply to the wildcard pattern it follows but to the first instance of text that pattern finds.

Well, okay, then. We’ll stop using numbers (such as {1,}) to specify how many times a pattern should be repeated (at least for our current purposes). Let’s try this instead:

([!^013]@, [!^013]@, [!^013]@, )[!^013]@(et al:)

Here’s what that means:

Find any characters except a carriage return: [!^013]
repeated any number of times: @
followed by a comma
followed by a space
repeated three times
and enclosed in parentheses to form a “group.”
Then find any character except a carriage return: [!^013]
repeated any number of times: @
followed by “et al:” in parentheses to form a group.

Well, son of a gun; that actually works. So now we can use the following in the “Replace With” box:

12

Here’s what that means:

Replace everything that was found
with the text represented by group 1: 1
followed by the text represented by group 2: 2

Group 1, you’ll remember, was this:

([!^013]@, [!^013]@, [!^013]@, )

It finds the first three names in our citations. And group 2 was this:

(et al:)

It finds the end of our citations.

And so, finally, we’ve succeeded in fulfilling Rich’s original request:

As written, your wildcard find and replace reduces four names to three if “et al:” is the ending characteristic. How do you write it so that it can handle any number of names, say up to seven?

Sometimes the easy way isn’t so easy. Nevertheless, it’s almost always worth pursuing. In Rich’s case, it reduced his editing time from hours (removing extraneous names by hand) to minutes (removing the names with a wildcard find and replace). It also gave Rich a wildcard search that he can save in his fabulous EditTools software for use with future projects. And it provided a deeper and clearer understanding of how to use wildcard searches.

After all these years of editing, wildcard searching is the tool I rely on the most. I encourage you to invest the time needed to learn to use this tool, which will repay your efforts many times over. A good place to start is my free paper “Advanced Find and Replace in Microsoft Word.”

I hope you’ll also watch for my forthcoming Wildcard Cookbook for Microsoft Word. I’m still trying to find more real-life examples for the book, so if you have some particularly sticky problems that might be solved using a wildcard search, I hope you’ll send them my way. Maybe I can save you some work and at the same time figure out solutions that will help others in the future. Thanks for your help!

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.


 

Looking for a Deal?

You can buy EditTools in a package with PerfectIt and Editor's Toolkit at a special savings of $78 off the price if bought individually. To purchase the package at the special deal price, click Editor's Toolkit Ultimate.

Lyonizing Word: We Can Do This the Easy Way, or . . .

We Can Do This the Easy Way,
or We Can Do This the Hard Way

by Jack Lyon

American Editor Rich Adin called me recently with a puzzle. He was editing a list of citations that looked like this:

Lyon J, Adin R, Poole L, Brenner E, et al: blah blah blah.

But his client wanted the citations to look like this:

Lyon J, Adin R, Poole L, et al: blah blah blah.

In other words, many of the citations included one author name too many; the client wanted a limit of three rather than four. And there were hundreds of citations. Rich really didn’t want to remove the superfluous names by hand; it would have taken hours to do, and hours are money. And so, Rich queried, “Is there a way to remove the fourth name automatically?”

There’s nearly always a way. Rich had already tried using a wildcard search, but without success. Microsoft Word kept telling him, “The Find What pattern contains a Pattern Match expression which is too complex.”

The Too-Complex Find What

I’m not sure what wildcard search Rich tried to use, but it might have looked like this:

Find what:

([A-Z][a-z]@ [A-Z], )([A-Z][a-z]@ [A-Z], )([A-Z][a-z]@ [A-Z], )([A-Z][a-z]@ [A-Z], )(et al:)

Replace with:

1235

That’s definitely too complex for Word to handle. Here’s what it means:

Find a capital letter ([A-Z])
followed by a lowercase letter ([a-z])
repeated any number of times (@)
followed by a space
followed by a capital letter ([A-Z])
followed by a comma
followed by a space
with all of that in parentheses to form a “group.”

All of that is repeated three more times, then followed by “et al:” in parentheses to form a group.

The “Replace with” string tells Word to replace what it finds with the contents of groups 1, 2, 3, and 5 — in other words, with the first three names followed by “et al:”.

What’s the Handle?

If Word could handle it, that should work. But Word can’t handle it, so we’ll need to simplify. So we ask ourselves, “What, besides letters, do all of the names have in common?” In other words, “What’s the handle? What can we grab onto?” Well, that’s easy — each name is followed by a comma and a space. That’s our handle!

(For more on this, please see my article "What’s Your Handle?" (2003) at the Editorium Update.)

The Find That Works

The handle means we can simplify our wildcard search string to something like this:

Find what:

([!^013]@, [!^013]@, [!^013]@, )[!^013]@, (et al:)

Replace with:

12

Here’s what that means:

Find any characters except a carriage return ([!^013])
repeated any number of times (@)
followed by a comma
followed by a space
with all of that repeated three times
and enclosed in parentheses to form a “group.”
Then it’s repeated one more time, ungrouped
and followed by “et al:” in parentheses to form a group.

The “Replace with” string tells Word to replace what it finds with the contents of groups 1 and 2 — in other words, with the first three names (group 1) followed by “et al:” (group 2). The fourth name is simply ignored.

To Group or Not to Group Using Parens

Rich ran the new find and replace, then replied, “Thanks, Jack, that works like a charm. Why isn’t the second ‘group’ grouped, that is, in parentheses? I thought that was necessary.”

I replied, “No, it’s not necessary. You group only the items that you want to reference (by 1, 2, etc.) in the ‘Replace with’ box. You could group the other item, in which case you would use ‘13’ in the ‘Replace with’ box. But there’s no need to do so.”

Note that this method of finding the names offers another advantage. Not only will it find names that look like this:

Lyon J,

it will also find names that look like this:

Lyon JM,

or even this:

Lyon JMQ

It will even find names like this:

Thaler-Carter Ruth,

or this:

Harrison G.B.H.,

In fact, it will find anything (except a carriage return) followed by a comma and a space.

Why the Carriage Return?

“Why,” you may be wondering, “specify anything but a carriage return? Why not specify letters instead?” Well, we could have done that, using something like this:

Find what:

([A-z ]@, [A-z ]@, [A-z ]@, )[A-z ]@, (et al:)

Replace with:

12

That means:

any capital or lowercase letter or space ([A-z ])
repeated any number of times (@)
followed by a comma
followed by a space
And so on.

Such a wildcard string would find names like this:

Lyon J,

but not this:

Thaler-Carter R,

Yes, we could add a hyphen to our string, but then we start to wonder about other characters we might need to include, and then things get complicated again. And besides, it’s true that we don’t want to include carriage returns in our search, so it makes sense to exclude them. If we tried to simplify too far, we might use this:

Find what:

(*, *, *, )*, (et al:)

Replace with:

12

The problem with using the asterisk wildcard (*) is that it finds any character any number of times, including tabs, spaces, carriage returns, and everything else you can think of. Sometimes that’s useful, but more often it just leads to confusion. We want to keep things simple but not too simple.

Why Wildcard

To return to our original problem: Rich could have removed all those extra names one at a time, by hand, which is doing it the hard way and eats into the profit line — remember that time is money. Microsoft Word includes powerful tools for doing things the easy way, so why not learn them and use them? If you’ve read this far, you’re doing that, so congratulations.

If you’d like to learn more about how to use wildcard searches, you can download my free paper “Advanced Find and Replace in Microsoft Word.” Working through the paper requires some thought and effort, but the payoff is huge.

Coming Soon

I hope you’ll watch for my forthcoming Wildcard Cookbook for Microsoft Word. I’m still trying to find more real-life examples for the book, so if you have some particularly sticky problems that might be solved using a wildcard search, I hope you’ll send them my way. Maybe I can save you some work and at the same time figure out solutions that will help others in the future. Thanks for your help!

For EditTools Users

If you are a user of EditTools, you can manually create the find and replace strings in the Wildcard Find & Replace macro and then save the macro for future use. However, to do so you need to enter the Find string slightly differently:

Find Field #1: [!^013]@, [!^013]@, [!^013]@,
Find Field #2: [!^013]@,
Find Field #3: et al:

Note that you omit the parens for grouping because EditTools automatically inserts them, which means that you break the string into its group components. (IMPORTANT: Be sure to include in Find Fields 1 and 2 the ending space, i.e., the space following the final comma, which is not visible above.)

Because EditTools treats each of the three fields as a group, your Replace string is:

Replace Field #1: 1
Replace Field #2: 3

After manually entering the information in each of the fields, click Add to WFR Dataset and save this macro for future use. Next time you need it, just click Retrieve from WFR Dataset, retrieve this string, and run it. That is one of the advantages to using EditTools' Wildcard Find & Replace — you can write a wildcard macro once and reuse it as many times as you need without having to recreate the macro each time.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Looking for a Deal?

You can buy EditTools in a package with PerfectIt and Editor's Toolkit at a special savings of $78 off the price if bought individually. To purchase the package at the special deal price, click Editor's Toolkit Ultimate.

 

Lyonizing Word: Shifting Styles

Shifting Styles

by Jack Lyon

In its undying efforts to be “helpful,” Microsoft Word can cause no end of problems. Among the worst of these are what I call “shifting styles,” which can change the formatting of your document without your consent and sometimes without your knowledge. Yow! I know of five ways this can happen. Here’s how to identify and fix each one.

Automatically Update Document Styles

The Problem

You go through your document, fine-tuning its style formatting to the peak of perfection. Then you carefully save your document for posterity. A week later, you reopen your document. What the…? All of your styles have shifted back to their original formatting. You’ll have to do all of that work over again! And how can you be sure it will stick?

The Solution

  1. Open the document.
  2. Click the Developer tab. (If you don’t have such a tab, click File > Options > Customize Ribbon. In the big window on the right, put a check in the box labeled “Developer. Then click the OK button.)
  3. Click the Document Template icon.
  4. Remove that dadburned checkmark in the box labeled “Automatically update document styles.”
  5. Resave your document.

The next time you open the document, your exquisite style formatting will remain intact.

So what’s the point of the “Automatically update document styles” feature? Well, let’s say that your boss just loves to tinker with the look of your company’s forms and stationery, mandating Helvetica one week and Comic Sans the next. If you turn on “Automatically update document styles” for every company document you create, changing the formatting is a snap. Just open the template on which the documents are based, modify the styles, and resave the template. The next time you open one of those documents, its styles will automatically update to match those of the template.

It’s a slick feature, as long as you know when — and when not — to use it.

Automatically Update Styles

The Problem

You’ve just opened a new document from a client, and you italicize the first paragraph, which is a short quotation introducing the chapter. But suddenly all of the chapter text is italicized. What in the world is going on?

You’ve just bumped into Word’s “Automatically update” feature for styles. (This feature affects only the styles in the current document, making it different from the “Automatically update document styles” feature discussed above.) If you don’t know about the “Automatically update” feature, you can spend hours trying to adjust formatting, only to have everything in sight messed up beyond belief.

The Solution

  1. Click the Home tab.
  2. In the Styles section of the Ribbon, right-click the style (such as Heading 1) applied to your text. (If you can’t see the style, click the little gray button under the Change Styles icon to open the Styles task pane.)
  3. Click Modify.
  4. Near the bottom right of the dialog, remove the checkmark from the box labeled “Automatically update.”
  5. Click the “OK” button.

Now when you modify some formatting in your document, you’ll change only the local selection and not everything that’s formatted in the same style. But really, you should avoid using directly applied formatting anyway. Using paragraph and character styles is much more efficient — the True Way — and avoids a multitude of problems.

So what’s the point of the “Automatically update” feature? It allows you to modify styles without drilling down, down, down through multiple menus. Well hey, that’s good! It means you can change formatting directly, see the result immediately, and have the styles updated automatically to reflect that formatting. Pretty neat!

So here’s my recommendation:

  • If you’re designing a document, use the “Automatically update” feature with a bunch of junk text to set your styles exactly the way you want them (be sure to select the whole paragraph before changing the format). Once you’ve got them set, turn off “Automatically update.” Then copy the styles to your real document, or save the junk document as a template that you attach to your real document.
  • If you’re writing or editing a document, make sure the “Automatically update” feature is turned off.

Styles Based on Styles

The Problem

You’re working away, editing a client’s document, and decide to modify the Heading 1 style to use a Goudy typeface. Whoa! Now the Heading 2 and Heading 3 styles are in Goudy as well. What’s going on here?

What’s going on is that your client has made the Heading 2 and Heading 3 styles “based on” the Heading 1 style. If you don’t know how this works, you’ll be scratching your head over the changing formats. If you do know how it works, you can use it to ensure consistent formatting throughout a document.

The Solution

If you don’t want your style to be based on another style, do this:

  1. Click the Home tab.
  2. In the Styles section of the Ribbon, right-click the style (such as Heading 1) applied to your text. (If you can’t see the style, click the little gray button under the Change Styles icon to open the Styles task pane.)
  3. Click Modify.
  4. In the “Style based on” dropdown list, select “no style” (the first option in the list).
  5. Click the OK button.

Problem solved.

But not so fast. Actually, this feature can be quite useful, as long as you know what’s going on.

Let’s say you want all of your headings to be set in Baskerville. It’s true that you could go through and set Heading 1, Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Heading 7, Heading 8, and Heading 9 (whew!) all to use that font (in varying point sizes, say). But now what if you want to switch to Palatino? Do you really have to go through and modify all of those styles again? Not if you originally based them all on Heading 1. If you did that, all you have to do is change the font for Heading 1, and all of your other heading styles will change as well. Pretty neat! Here’s how to do it:

  1. Click the Home tab.
  2. In the Styles section of the Ribbon, right-click the style (such as Heading 2) applied to your text. (If you can’t see the style, click the little gray button under the Change Styles icon to open the Styles task pane.)
  3. Click Modify.
  4. In the “Style based on” dropdown list, click the style (Heading 1, for example) on which you want to base the current style.
  5. Click the OK button.

Now, whenever you modify the “parent” style (Heading 1), the “child” style (Heading 2) will be modified automatically.

Please note, however, that any changes you make to the “child” style will override the attributes inherited from the “parent” style. For example, if Heading 1 is set to 18 points, you can still modify Heading 2 (based on Heading 1) as 14 points. If you do that, though, you may wonder how to get rid of the override if you need to. Here’s the secret: change the attribute in Heading 2 back to the way it’s set in Heading 1 (14 points back to 18 points). The “child” style will simply pick up its attributes from the “parent style” once again.

You can use this feature to set up whole families of styles that are based on a “parent” style. For example, you might want to set up a family of heading styles, a family of body text styles, and a family of list styles, and then store them all in a special template. Just be sure to use a naming convention that makes it easy to remember which styles are the “parents.” The easiest way to do this may be to use “1” to designate “parent” styles: Heading 1, Body Text 1, List 1, and so on. Then you can use other numbers (2, 3, 4) to indicate “child” styles.

AutoFormat Headings

The Problem

You’re typing along, and suddenly the short line you entered a couple of paragraphs earlier has turned big and bold. Who does it think it is, anyway? When you investigate, you discover that the line has somehow been formatted with Word’s Heading 1 style.

You’ve just discovered one of the wonders of Word’s AutoFormat feature, which should be firmly beaten into submission before it takes over your whole document.

The Solution

  1. Click File > Options > Proofing.
  2. Click the button labeled “AutoCorrect Options.”
  3. Click the tab labeled “AutoFormat As You Type.”
  4. Under “Apply as you type,” remove the check from the box labeled “Built-in Heading Styles.”
  5. Click the OK button.
  6. Click the next OK button.

Now if you type a line of text ending in a carriage return but without ending punctuation (which, by the way, seems to be the defining factor here), Word will no longer see it as a heading and will no longer try to format it as such.

Define Styles Based on Your Formatting

The Problem

As explained above, you’ve turned off the AutoFormat option to apply headings as you type, but you still get automatic formatting. If that’s the case, you may still have the last “AutoFormat As You Type” option turned on. It’s labeled “Define styles based on your formatting,” and Microsoft explains its function like this: “Create new paragraph styles based on the manual formatting you apply in your documents. You can apply these styles in your document to save time and to give your documents a consistent ‘look.’”

The idea that Word is creating new styles as I work just gives me the heebie-jeebies.

The Solution

  1. Click File > Options > Proofing.
  2. Click the button labeled “AutoCorrect Options.”
  3. Click the tab labeled “AutoFormat As You Type.”
  4. Under “Apply as you type,” remove the check from the box labeled “Define styles based on your formatting.”
  5. Click the OK button.
  6. Click the next OK button.

Problem solved — no more proliferation of unwanted styles.

The whole issue with all of these problems is one of control. How much “help” do you want Microsoft Word to give you? If you’re editing, your answer may be “none,” because editors need to have complete control over what’s happening, and they can’t have Word introducing changes they may not even be aware of. When I’m editing, I disable all of these features. If you’ve been suffering from the madness of shifting styles, maybe you’ll want to do the same.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

The Business of Editing: Wildcarding for Dollars

Freelancers often lack mastery of tools that are available to us. This is especially true of wildcarding. This lack of mastery results in our either not using the tools at all or using them to less than their full potential. These are tools that could save us time, increase accuracy, and, most importantly, make us money. Although we have discussed wildcard macros before (see, e.g., The Only Thing We Have to Fear: Wildcard Macros, The Business of Editing: Wildcard Macros and Money, and Macro Power: Wildcard Find & Replace; also see the various Lyonizing Word articles), after recent conversations with colleagues, I think it is time to revisit wildcarding.

Although wildcards can be used for many things, the best examples of their power, I think, are references. And that is what we will use here. But remember this: I am showing you one example out of a universe of examples. Just because you do not face the particular problem used here to illustrate wildcarding does not mean wildcarding is not usable by you. If you edit, you can use wildcarding.

Identifying the What Needs to Be Wildcarded

We begin by identifying what needs a wildcard solution. The image below shows the first 3 references in a received references file. This was a short references file (relatively speaking; I commonly receive references files with 500 to 1,000 references), only 104 entries, but all done in this fashion.

references as received

references as received

The problems are marked (in this essay, numbers in parens correspond to numbers in the images): (1) refers to the author names and the inclusion of punctuation; (2) shows the nonitalic journal name followed by punctuation; and (3) shows the use of and in the author names. The following image shows what my client wants the references to look like.

references after wildcarding

references after wildcarding

Compare the numbered items in the two images: (1) the excess punctuation is gone; (2) the journal title is italicized and punctuation free; and (3) the and is gone.

It is true that I could have fixed each reference manually, one-by-one, and taken a lot of time to do so. Even if I were being paid by the hour (which I'm not; I prefer per-page or project fees), would I want to make these corrections manually? I wouldn't. Not only is it tedious, mind-numbing work, but it doesn't meet my definition of what constitutes editing. Yes, it is part of the editing job, but I like to think that removing punctuation doesn't reflect my skills as a wordsmith and isn't the skill for which I was hired.

I will admit that in the past, in the normal course, if the reference list were only 20 items long, I would have done the job manually. But that was before EditTools and its Wildcard macro, which enables me to write the wildcard string once and then save it so I can reuse it without rewriting it in the future. In other words, I can invest time and effort now and get a reoccurring return on that investment for years to come. A no-brainer investment in the business world.

The Wildcard Find

CAUTION: Wildcard macros are very powerful. Consequently, it is recommended that you have a backup copy of your document that reflects the state of the document before running wildcard macros as a just-in-case option. If using wildcard macros on a portion of a document that can be temporarily moved to its own document, it is recommended that you move the material. Whenever using any macro, use caution.

Clicking Wildcard in EditTools brings up the dialog shown below, which gives you options. If you manually create Find and Replace strings, you can save them to a wildcard dataset (1) for future recall and reuse. If you already have strings that might work, you can retrieve them (2) from an existing wildcard dataset. And if you have taken the next step with Wildcards in EditTools and created a script, you can retrieve the script (3) and run it. (A script is simply a master macro that includes more than 1 string. Instead of retrieving and running each string individually, you retrieve a script that contains multiple strings and run the script. The script will go through each string it contains automatically in the order you have entered the strings.)

Wildcard Interface

Wildcard Interface

As an example, if I click Retrieve from WFR dataset (#2 above), the dialog shown below opens. In this instance, I have already created several strings (1) and I can choose which string I want to run from the dropdown. Although you can't see it, this particular dataset has 40 strings from which I can choose. After choosing the string I want to run, it appears in the Criteria screens (2 and 3), divided into the Find portion of the string and the Replace portion. I can then either Select (4) the strings to be placed in primary dialog box (see Wildcard Interface above) or I can Edit (5) the strings if they need a bit of tweaking.

Wildcard Dataset Dialog

Wildcard Dataset Dialog

If I click Select (4 above), the strings appear in the primary Wildcard dialog as shown below (1 and 2). Because it can be hard to visualize what the strings really look like when each part is separated, you can see the strings as they will appear to Microsoft Word (3). In addition, you know which string you chose because it is identified above the criteria fields (purple arrow). Now you have choices to make. You can choose to run a Test to be sure the criteria work as expected (4), or if you know the criteria work, as would be true here, you can choose to Find and Replace one at a time or Replace All (5).

The Effect of Clicking Select

The Effect of Clicking Select

I know that many readers are saying to themselves, "All well and good but I don't know how to write the strings, so the capability of saving and retrieving the strings isn't of much use to me." Even if you have never written a wildcard string before, you can do so quickly and easily with EditTools.

Creating Our String

Let's begin with the first reference shown in the References as Received image above. We need to tackle this item by item. Here is what the author names look like as received:

Kondo, M., Wagers, A. J., Manz, M. G., Prohaska, S. S., Scherer, D. C., Beilhack, G. F. et al.:

What we have for the first name in the list is

[MIXED case multiletter surname][comma][space][single UPPERCASE letter][period][comma]

which makes up a unit. That is, a unit is the group of items that need to be addressed as a single entity. In this example, each complete author name will constitute a unit.

This first unit has 6 parts to it (1 part = 1 bracketed item) and we have identified what each part is (e.g., [MIXED case multiletter surname]). To find that first part we go to the Wildcard dialog, shown below, click the * (1) next to the blank field in line 1. Clicking the * brings up the Select Wildcard menu (2) from which we choose we choose Character Menu (3). In the Character Menu we choose Mixed Case (4) because that is the first part of the unit that we need to find.

Wildcard First Steps

Wildcard First Steps

When we choose Mixed Case (4 above), the Quantity dialog below appears. Here you tell the macro whether there is a limit to the number of characters that fit the description for this part. Because we are dealing with names, just leave the default of no limit. However, if we knew we only wanted names that were, for example, 5 letters or fewer in length, we would decheck No Limit and change the number in the Maximum field to 5.

How many letters?

How many letters?

Clicking OK in the Quantity results in entry of the first portion of our string in the Wildcard dialog (1, below). This tells the macro to find any grouping of letters — ABCd, Abcde, bCdaefTg, Ab, etc. — of any length, from 1 letter to 100 or more letters. Thus we have the criteria for the first part of our Find unit even though we did not know how to write wildcardese. In the dialog, you can see how the portion of the string really looks to Microsoft Word (2) and how, if you were to manually write this part using Microsoft Word's Find & Replace, it would need to be written.

How this part looks in wildcardese

How this part looks in wildcardese

The next step is to address the next part, which can be either [comma] alone or [comma][space]. What we need to be careful about is that we remember that we will need the [space] in the Replace string. If we do [comma][space] and if we do not have just a [space] entry, we will need to provide it. For this example, I will combine them.

Because these are simple things, I enter the [comma][space] directly in the dialog as shown below. With my cursor in the second blank field (1), I simply type a comma and hit the spacebar. You can verify this by looking below in the Find line of wildcardese (2), where you can see (, ):

Manually adding the next part

Manually adding the next part

The remaining parts to do are [single UPPERCASE letter][period][comma]. They would be done using the same techniques as the prior parts. Again, we would have to decide whether the [period] and [comma] need to go on separate lines or together on a single line. Why? Because we want to eliminate the [period] but keep the [comma]. If they are done together as we did [comma][space], we will manually enter the [comma] in the Replace.

For the [single UPPERCASE letter], we would follow the steps in Wildcard First Steps above except that instead of Mixed Case, we would select UPPER CASE, as shown here:

Selecting UPPER CASE from the Characters Menu

Selecting UPPER CASE from the Characters Menu

This brings up the Quantity dialog where we decheck No Limit and, because we know it is a single letter we want found, use the default Minimum 1 and Maximum 1, as shown here:

A Quantity of 1

A Quantity of 1

Clicking OK takes us to the main Wildcard dialog where the criteria to find the [single UPPERCASE letter] has been entered (1, below). Looking at the image below, you can see it in the string (2). For convenience, the image also shows that I manually entered the [period][comma] on line 4 (3 and 4).

The rest of the Find criteria

The rest of the Find criteria

The Wildcard Replace

The next step is to create the Replace part of the string. Once again, we need to analyze our Find criteria.

We have divided the Find criteria into these 4 parts, which together make up the Find portion of the string:

  1. [MIXED case multiletter surname]
  2. [comma][space]
  3. [single UPPERCASE letter]
  4. [period][comma]

The numbers represent the numbers of the fields that are found in the primary dialog shown above (The Rest of the Find Criteria). What we need to do is determine which fields we want to replace and in what order. In this example, what we want to do is remove unneeded punctuation, so the Replace order is the same as the Find order. We want to end up with this:

  1. [MIXED case multiletter surname]
  2. [space]
  3. [single UPPERCASE letter]
  4. [comma]

The way we do so is by filling in the Replace fields. The [space] and the [comma] we can enter manually. You can either enter every item manually or you can let the macro give you a hand. Next to each field in the Replace column is an *. Clicking on the * brings up the Select Wildcard dialog:

Select Wildcard

Select Wildcard

Because what we need is available in the Find Criteria, we click on Find Criteria. However, the Select Wildcard dialog also gives us options to insert other items that aren't so easy to write in wildcardese, such as a symbol. When we click Find Criteria, the Use Find Criteria dialog, shown below, appears. It lists everything that is found in the Find criteria by line.

Use Find Criteria dialog

Use Find Criteria dialog

Double-clicking the first entry (yellow highlighted) places it in the first line of the Replace, but by a shortcut — 1 — as shown in the image below (1). If we wanted to reverse the order (i.e., instead of ending up with Kondo M, we want to end up with M Kondo,), we would select the line 3 entry in the Use Find Criteria Dialog above, and double-click it. Then 3 would appear in the first line of Replace instead of 1.

The completed wildcard macro

The completed wildcard macro

For convenience, I have filled the Replace criteria (1-4) as The Completed Wildcard Macro image above shows. The [space] (2) and the [comma] (4) I entered manually using the keyboard. The completed Replace portion of the string can be seen at (5).

The next decision to be made is how to run the string — TEST (6) or manual Find/Replace (7) or auto Replace All (8). If you have not previously tried the string or have any doubts, use the TEST (6). It lets you test and undo; just follow the instructions that appear. Otherwise, I recommend doing a manual Find and Replace (7) at least one time so you can be certain the string works as you intend. If it does work as intended, click Replace All (8).

You will be asked whether you want to save your criteria; you can preempt being asked by clicking Add to WFR dataset (9). You can either save to an existing dataset or create a new dataset. And if you look at the Wildcard Dataset dialog above (near the beginning of this essay), you will see that you can not only name the string you are saving, but you can provide both a short and a detailed description to act as reminders the next time you are looking for a string to accomplish a task.

Spend a Little Time Now, Save Lots of Time Later

Running the string we created using Replace All on the file we started with, will result in every instance of text that meets the Find criteria being replaced. I grant that the time you spend to create the string and test it will take longer than the second and subsequent times you retrieve the string and run it, but that is the idea: spend a little time now to save lots of time later.

I can tell you from the project I am working on now that wildcarding has saved me more than 30 hours of toiling so far. I have already had several chapters with 400 or more references that were similar to the example above (and a couple that were even worse). Wildcarding let me clean up author names, as here, and let me change cites from 1988;52(11):343-45 to 52:343, 1988 in minutes.

As you can see from this exercise, wildcarding need not be difficult. Whether you are an experienced wildcarder or new to wildcarding, you can harness the power of wildcarding using EditTools' WildCard Find & Replace. Let EditTools' WildCard Find & Replace macro system help you. Combine wildcarding with EditTools' Journals macro and references become quicker and easier.

Richard Adin, An American Editor

Related An American Editor essays are:

_________________________

Looking for a Deal?

You can buy EditTools in a package with PerfectIt and Editor's Toolkit at a special savings of $78 off the price if bought individually. To purchase the package at the special deal price, click Editor's Toolkit Ultimate.

Lyonizing Word: The Right Tool for the Job

The Right Tool for the Job

by Jack Lyon

The sardine fork. The oyster ladle. The cake breaker. The butter pick. Those persnickety Victorians had a utensil for everything! You’ll find some interesting examples here:

Was all of that really necessary? I still eat the occasional sardine, and an ordinary table fork gets the job done. But I’m willing to bet that if I ever tried an actual sardine fork, I’d immediately realize the advantages of doing so. If I ever needed to ladle out oysters, I’ll bet an oyster ladle would be the perfect tool for the job.

The Wrong Tools

Every editor I know uses Microsoft Word. It’s the standard solution, the default program, the accepted tool for word processing. But is it the best tool for editing? Out of the box, it’s not. It has too many features that editors don’t need, and they’re always getting in the way.

When you’re editing, how often do you use SmartArt? How about WordArt? Page color? No? Then why not get rid of them? Why not turn Word into a lean, mean, editing machine? You can do this by customizing Word’s Ribbon. To do so, click File > Options > Customize Ribbon.

On the right side of your screen, you’ll now see a list of the Ribbon tabs and groups, like this:

Jack Lyon Graphic 1

Notice that I’ve unchecked the “Mailings tab.” I don’t want it showing because it’s something I never use. (Note: If you use macros, you should probably keep the “Developer” tab; it allows access to those macros and also allows you to load various document templates that may include macros.)

Now see that dropdown list at the top of the window? The one that says “Main Tabs”? Click it and select “All Tabs.” Now you’ll have many more options to uncheck:

Jack Lyon Graphic 2

Do you really need Chart Tools? Drawing Tools? Picture Tools? If not, make them go away. (Don’t worry—if necessary, you can always get them back again.)

So far, we’ve been removing whole groups of features at once, but you can also remove individual items from a group—if they are items you’ve previously added. Unfortunately Microsoft won’t let you remove the individual default features they think you need to have.

The Right Tools

The other problem with Microsoft Word is that it doesn’t have enough of the tools that editors need—at least not by default. Here again, the solution is to customize the Ribbon. Again, click File > Options > Customize Ribbon. This time, look at the window on the left. In the top dropdown box, select “Commands Not in the Ribbon.” Very interesting!

Jack Lyon Graphic 3

These are Word’s “hidden” commands, the features I encouraged you to explore in my previous article “Let’s Go Spelunking!”

Using the buttons in the window, you can add these features to the groups of your choice on Word’s Ribbon. You can even add your own custom tabs and groups by clicking the buttons labeled “New Tab” and “New Group.” How about adding a tab called something like “Editing Tools,” with all of the features you need for editing? If you’re also a writer, you could add a tab called “Writing Tools.” Some of the features would be different; some of the features would be the same. There’s nothing wrong with having certain features duplicated between tabs or groups, if that makes your work easier.

You can select other features by clicking the dropdown list and selecting “All Commands.” You can even select macros and add them to the Ribbon.

Add-In Tools

Unfortunately, even with the wealth of features that Word provides, there are other editing tools that Word doesn’t provide. For example, how often do you need to transpose two words? Two characters? How much time do you spend lowercasing articles and prepositions in titles? How often do you have to reach for the mouse in order to apply a style?

This is where add-in programs come in. “What’s an add-in program?” you ask. An add-in program is a Microsoft Word template that includes custom macros, Ribbon items, and keyboard shortcuts created specifically for a particular task—kind of like those Victorian utensils. As the name suggests, an add-in isn’t an independent piece of software; it actually works inside Microsoft Word, adding new features that then seem to be an integral part of Word. This isn’t some kind of hack, by the way; Microsoft Word was designed to support such add-ins, which is what makes them possible.

I’m partial to my own add-ins, of course, the ones I sell on the Editorium website. I’m really an editor, not a programmer, and I created these add-ins to make my own work easier. But I think you might like them too.

One of my favorites is the “Cap Title Case” feature in Editor’s ToolKit. When I’m working on a manuscript and come across a title like “The Ghost In The Machine,” or worse, “THE GHOST IN THE MACHINE,” I select the title and press the F5 function key (which activates the “Cap Title Case” feature). Like magic, the title is now capped like this: “The Ghost in the Machine.”

If I want to transpose two words, I put my cursor anywhere in the second word and press the F11 key. To transpose two characters, I press F12. Rather than reaching for the mouse to apply a style, I press F5, which puts all of the styles at my fingertips. And as they say on television, there’s much, much more!

All of these are small things, but those small things add up to big savings in time. And when you’re editing for a living, time is money.

So how much is an add-in actually worth? If it saves you an hour on a single project, it’s probably paid for itself. On the next project, it pays for itself again. And on and on, into the future. Seldom does such a small investment reap such big rewards.

Yes, this is a sales pitch, but I genuinely want you to succeed. That’s why I promote other add-ins like Rich Adin’s EditTools and Daniel Heuman’s PerfectIt.

These tools can make a real difference in how efficiently you work and how much money you can make. With that in mind, why not get them all, at a very special price?

Don’t think of these tools as an expense; think of them as an investment. Then the next time you need an editing tool, you’ll have it—and it will be the right tool for the job. Instead of dishing out tomato slices with a fork, you can use a tomato spoon! Instead of picking up bacon with your fingers, you can use a bacon fork! Using the right tool for the job makes all the difference in the world.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Lyonizing Word: Formatting with Macros

Formatting with Macros

by Jack Lyon

Most users of Microsoft Word format text by selecting a paragraph and then applying a font. More advanced users apply a style. Here’s why:

  1. Styles are easier to use than direct formatting. Once you have the style set up (with, say, 12-point Arial bold, condensed by 1 point, left justified, with 24 points of leading above and 12 points of leading below), you can apply that style with a single click. But if you apply the same formatting without using a style, you’ll have to make a dozen clicks for each heading. If your document has 50 headings, that’s hundreds of clicks—versus 50 clicks if you use a style.
  2. If you need to change the formatting of, say, level-2 headings, you can simply modify the style rather than tediously selecting each heading and applying a different font. Modify the style, and the formatting of all those headings is automatically changed.

But there is a way to handle formatting that is even more powerful—by using macros.

Suppose that you’ve dutifully applied styles to the various parts of a document, but then your client asks you to change the font—everywhere in the document—from Times New Roman to Adobe Garamond. (No, you should not just select the whole document and apply Adobe Garamond. Why? Because that simply “paints over” the real formatting that is still there in the styles, and it will almost certainly lead to inconsistent formatting somewhere down the line.) You could manually modify each style, but if there are dozens of styles in use, there is a better way. That way is a macro, like this one:

Sub SetFontInAllStyles()
Dim aStyle As Style
For Each aStyle In ActiveDocument.Style
aStyle.Font.Name = "Adobe Garamond"
Next
End Sub

Well, that was easy. Let’s look at each line of the macro (excluding the first and last lines, which simply define the beginning and end of the macro).

Dim aStyle As Style

This line defines (dimensions) a variable, aStyle (which name I just made up), as a style. At one point as the macro runs, aStyle might represent the style Heading 1. At another point it might represent Heading 3. But it will always represent a style.

For Each aStyle In ActiveDocument.Styles

Here's where things start to get interesting. That line tells the macro to cycle through each style (represented by aStyle) in all of the styles in the active document (the document in which your cursor is currently sitting).

aStyle.Font.Name = "Adobe Garamond"

And that line tells Word to set the font for the style currently being represented by aStyle to be Adobe Garamond.

Next

The “Next” line tells Word to go to the next style in the document.

When you run the macro, it will cycle through each style in the document (For Each…) and set Adobe Garamond as the font used in that style.

But what if you want to change the font only in heading styles (Heading 1, Heading 2, and so on)? Try this:

Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles
If InStr(aStyle.NameLocal, "Heading") Then aStyle.Font.Name = "Adobe Garamond"
Next
End Sub

Here's the line of interest:

If InStr(aStyle.NameLocal, "Heading") Then aStyle.Font.Name = "Adobe Garamond"

That line uses a macro command we haven't seen before, InStr, which checks for specific text in a larger string of text. In this case, it checks to see if the text “Heading” appears in the name of the style (for example, “Heading 4”). If it does, then the macro sets the font for the Heading style as Adobe Garamond.

Armed with that little beauty, you can pull off all kinds of formatting marvels. Here are just a few of the options available:

If InStr(aStyle.NameLocal, "Heading") Then aStyle.Font.Bold = True

If InStr(aStyle.NameLocal, "Heading") Then aStyle.ParagraphFormat.Alignment = wdAlignParagraphCenter

If InStr(aStyle.NameLocal, "Heading") Then aStyle.NoSpaceBetweenParagraphsOfSameStyle = True

You can even specify the exact name of the style (rather than using InStr):

If aStyle.NameLocal = "Normal" Then aStyle.ParagraphFormat.Alignment = wdAlignParagraphJustify

If aStyle.NameLocal = "Heading 3" Then aStyle.Font.Italic = True

All of Word’s formatting options are at your disposal.

So yes, if you’re formatting a Word document, you should always use styles. But if you need to modify styles en masse, now you know how.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

________

How to Add Macro to Word & to the QAT

Here’s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:

  1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.”
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Type a name for the macro in the “Macro name” box — probably the name used after the first “Sub.” For this macro, that’s “______________.”
  5. Click the “Create” button.
  6. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).
  7. Paste the macro text at the current insertion point.
  8. Click “File,” then “Close and Return to Microsoft Word.”

To actually use the macro:

  1. Place your cursor ___________________.
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Click the name of your macro to select it.
  5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

Here’s how to put the macro on Word’s QAT (Quick Access Toolbar):

  1. Locate the QAT (it’s probably on the top left of your screen either above or below Word’s Ribbon interface).
  2. Right-click the QAT.
  3. Click “Customize Quick Access Toolbar.”
  4. Under “Choose commands from:” click the dropdown list and select “Macros.”
  5. Find and select your macro in the list on the left.
  6. Click the “Add” button to add it to the QAT.
  7. Click the “OK” button to finish.

Lyonizing Word: Formatting with Macros

Formatting with Macros

by Jack Lyon

Most users of Microsoft Word format text by selecting a paragraph and then applying a font. More advanced users apply a style. Why? Because then if they need to change the formatting of, say, level-2 headings, they can simply modify the style rather than tediously selecting each heading and applying a different font. (If you’re reading this, you’re probably one of those advanced users.) But there is a way to handle formatting that is even more powerful.

Suppose that you’ve dutifully applied styles to the various parts of a document, but then your client asks you to change the font—everywhere in the document—from Times New Roman to Adobe Garamond. You could manually modify each style, but if there are dozens of styles in use, there is a better way. That way is a macro, like this one:

Sub SetFontInAllStyles()
Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles

aStyle.Font.Name = "Adobe Garamond"

Next
End Sub

Well, that was easy. Let's look at each line of the macro (excluding the first and last lines, which simply define the beginning and end of the macro).

Dim aStyle As Style

That line dimensions (defines) a variable, aStyle, as a style. (As with all variables, I just made up the name “aStyle.”) At one point as the macro runs, aStyle might represent the style Heading 1. At another point it might represent Heading 3. But it will always represent a style.

For Each aStyle In ActiveDocument.Styles

Here's where things get interesting. That line tells the macro to cycle through each style (represented by aStyle) in all of the styles in the active document (the document in which your cursor is currently sitting).

aStyle.Font.Name = "Adobe Garamond"

That line tells Word to set the font for the style currently being represented by aStyle to be Adobe Garamond.

Next

That line tells Word to go to the next style in the document.

When you run the macro, it will cycle through each style in the document (For Each…Next) and set Adobe Garamond as the font used in that style.

But what if you want to change the font only in heading styles (Heading 1, Heading 2, and so on)? Try this:

Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles

If InStr(aStyle.NameLocal, "Heading") Then aStyle.Font.Name = "Adobe Garamond"

Next
End Sub

Here's the line of interest:

If InStr(aStyle.NameLocal, "Heading") Then aStyle.Font.Name = "Adobe Garamond"

The line uses a macro command we haven't seen before, InStr, which checks to see if a specific string of text is used somewhere. In this case, it checks to see if the text “Heading” appears in the name (NameLocal) of the style currently represented by aStyle. If it does, then the name of the font used in that style is set to Adobe Garamond.

You could even specify the exact name of the style to be changed:

If aStyle.NameLocal = "Block Quote" Then aStyle.Font.Name = "Adobe Garamond"

And that should give you an idea of how to modify a bunch of styles, all at once (between “For Each” and “Next”), to use various fonts:

If aStyle.NameLocal = "Poem" Then aStyle.Font.Name = "Arial"

If aStyle.NameLocal = "Author" Then aStyle.Font.Name = "Apple Boy"

If aStyle.NameLocal = "Subtitle" Then aStyle.Font.Name = "Constantia"

Much more can be done to automate the formatting of text using macros. I hope this brief article will get you started.

How to Add Macro to Word & to the QAT

Here’s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:

  1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.”
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Type a name for the macro in the “Macro name” box — probably the name used after the first “Sub.” For this macro, that’s “CleanCellEndSpaces.”
  5. Click the “Create” button.
  6. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).
  7. Paste the macro text at the current insertion point.
  8. Click “File,” then “Close and Return to Microsoft Word.”

To actually use the macro:

  1. Place your cursor at the beginning of the document.
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Click the name of your macro to select it.
  5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

Here’s how to put the macro on Word’s QAT (Quick Access Toolbar):

  1. Locate the QAT (it’s probably on the top left of your screen either above or below Word’s Ribbon interface).
  2. Right-click the QAT.
  3. Click “Customize Quick Access Toolbar.”
  4. Under “Choose commands from:” click the dropdown list and select “Macros.”
  5. Find and select your macro in the list on the left.
  6. Click the “Add” button to add it to the QAT.
  7. Click the “OK” button to finish.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Lyonizing Word: The Next Character Macro

Today’s column by Jack Lyon marks the first essay in a new monthly series, “Lyonizing Word.” In this series, Jack will discuss using Microsoft Word, especially macros, to best advantage during the editing process. Please welcome Jack as a new columnist for An American Editor.

______________

Lyonizing Word: The Next Character Macro

by Jack Lyon

Macros and mastering Microsoft Word are keys to success in the business of editing. One can be a great editor and not master either, but it is more difficult, if not near-impossible, to have a successful editing business if you aren’t master of the tools you use.

My plan is to help you master Word and Word macros. My hope is that you will learn from each of my columns and will take the lessons learned and build on them yourself — for example, by building more complex and more useful macros that fulfill a need in your editing business. Here’s my first installment, which I hope you’ll find useful.

The NextCharacter Macro

I often use character codes while finding and replacing in Microsoft Word. What’s a character code? Here are some common ones:

^09 is a tab
^13 is a carriage return
^32 is a space

Especially in a wildcard search, you may have to use such codes because Word’s wildcard search engine can’t handle certain characters and will give you an error message if you try to use them.

But what if you don’t know the code for the character you need? You can probably look it up online or in a computer book, but wouldn’t it be nice to have a macro that would tell you immediately? Just put your cursor in front of the character and run the macro to get the code number. Here’s a macro that will do just that:

Sub NextCharacter()
Dim NextChar As String
NextChar = Str(AscW(Selection))
MsgBox “The code for the next character is” & NextChar
End Sub

That’s pretty simple, but there’s still a lot going on. Let’s look at each line in the macro.

Sub NextCharacter()

Here we tell Word the name of the macro, which is a subroutine (Sub) named NextCharacter. You can use pretty much any name you like, as long as it doesn’t start with a number or include any spaces. And the parentheses at the end of the name? I’ll reserve that discussion for a future article.

Dim NextChar As String

I just made up the name NextChar but not the commands around it, all of which are part of VBA (Visual Basic for Applications), Microsoft’s programming language for Word and other programs in the Office suite. If you want to learn more about “Dim,” “As,” “String,” and other VBA commands, here’s a good place to start: Getting Started with VBA in Word 2010.

In this line, we’re “dimensioning” (Dim) a variable to hold a value (NextChar) that we’ll use later in the macro. A variable is just a placeholder that can hold a value, like X in your high-school algebra class. Dimensioning just tells Word what *kind* of value we’re using — in this case, a string of characters rather than, say an integer, which can only hold numbers.

NextChar = Str(AscW(Selection))

This assigns a value to the NextChar variable. What value? The one produced by this:

Str(AscW(Selection))

“Selection” is the character to the right of your cursor (in the Western world).

“AscW” tells Word to find the ASCII or Unicode value of that character.

“Str” turns that value into a string — that is, characters rather than a value. Why? So we can see those characters in the message box produced by the next line:

MsgBox “The code for the next character is” & NextChar

This displays a message box (MsgBox) that gives us the code for the next character (as stored in NextChar), preceded by the text “The code for the next character is” just to pretty things up.

End Sub

This line simply ends the macro, or subroutine.

Now, here’s how to put this macro (or any other) into Microsoft Word so it will be available when you need it:

  1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.”
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Type a name for the macro in the “Macro name” box — probably the name used after the first “Sub.” For this macro, that’s “NextCharacter.”
  5. Click the “Create” button.
  6. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty (unless you already have other macros in there).
  7. Paste the macro text at the current insertion point.
  8. Click “File,” then “Close and Return to Microsoft Word.”

To actually use the macro:

  1. Place your cursor directly in front of the character you want to identify.
  2. Click the “View” tab on Microsoft Word’s ribbon.
  3. Click the “Macros” button.
  4. Click the name of your macro to select it.
  5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

After the macro runs, a dialog box will appear with the numeric code for the character. To dismiss the dialog box, click OK.

Now that you know the code for the character after your cursor, you can use that code in Word’s Find dialog. Or you can insert it into your document. To do so, hold down the ALT key and enter the code on the numeric keypad. For example, the code for an uppercase A is 65. You could insert that character by holding down the ALT key and entering 65 on the numeric keypad. Of course, it’s a lot easier just to hold down SHIFT and hit the A key, but what if you need to enter something more esoteric? Microsoft provides a code chart here: ANSI Character Codes Chart.

That’s it! I hope you find the macro useful, and that my explanation here helps you understand a little more about how macros work.

Jack Lyon (editor@editorium.com) owns and operates the Editorium, which provides macros and information to help editors and publishers do mundane tasks quickly and efficiently. He is the author of Microsoft Word for Publishing Professionals and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.