Converting Fields to Regular Text (and Why That Matters)

By Jack Lyon, the Editorium

Microsoft Word documents often include fields that authors use to insert text that isn't really text: dates, page references, author names, and much more. If you're editing a document that includes text copied and pasted from a web page (quite frequent these days), the text probably includes hyperlink fields, perhaps in a nice shade of blue or purple. Other kinds of fields may be indistinguishable from regular text, but that doesn't mean they'll translate correctly for publication. Usually, all of those fields first need to be converted to regular text. There are several ways to do that.

From the keyboard

  1. Press CTRL + A to select all text.
  2. Press CTRL + 6 to convert fields to text.

Using macros

This macro does the same thing as the keyboard procedure above:

Sub ConvertFieldsToText()
    selection.WholeStory
    selection.Fields.Unlink
End Sub

This macro converts hyperlinks only:

Sub RemoveHyperlinks()
    Dim oField As Field
    For Each oField In ActiveDocument.Fields
        If oField.Type = wdFieldHyperlink Then
            oField.Unlink
        End If
    Next
    Set oField = Nothing
End Sub

To use the macros, follow the instructions here.

The really interesting line in that last macro is this one, which identifies the type of field we want to unlink:

If oField.Type = wdFieldHyperlink Then

The reason that's interesting is that we can specify a different type of field using any of the options listed here. Go ahead, be choosy!

Using Editor's ToolKit Plus

Editor's ToolKit Plus makes the conversion easy. Just click the "Text" button and then click "Convert hyperlinks to regular text." (This actually converts all fields to regular text.)

img

Deleting (rather than just converting) fields

If you want to actually delete the fields (not just convert them to text), Allen Wyatt provides a good solution here.

Lyonizing Word: Inside Notes

by Jack Lyon

As useful as they are, Microsoft Word’s footnotes and endnotes are amazingly easy to mess up. Let’s look at some ways that can happen — and how to fix the problems.

First, we need to open a document that has footnotes — or make one. Then, to really see what’s going on, we’ll do this:

  1. Click “View” and then “Draft.”
Click "View" then "Draft"

Click "View" then "Draft"

2. Click “References” and then “Show Notes.”

Click “References” and then “Show Notes”

Click “References” and then “Show Notes”

That should take you into Word’s “Notes Pane,” which should look something like this:

Word’s “Notes Pane"

Word’s “Notes Pane"

Deleted Reference Numbers

The superscript numbers in front of each note are called reference numbers. By default, they’re formatted with a character style — either Footnote Reference or Endnote Reference, which you can modify if necessary. What’s interesting about these numbers is that it’s possible to delete them, so the notes look like this:

Deleting Note Numbers

Deleting Note Numbers

Deleting them, however, is an extraordinarily bad idea. Those numbers may look simple, but under the hood they have a lot going on. The number itself is automatically generated based on the reference number in the text itself. (If you create footnote number 9 in your document, the note itself will start with the number 9. If you delete footnote number 9 in your document, the note and its number will be deleted.) The number also signals the start of a new note, and if it’s gone, document corruption is probably not far behind.

You can often tell if a reference number is missing by looking at the other note numbers. If they’re numbered like this, you know something’s wrong:

A Clue That Something Is Wrong

A Clue That Something Is Wrong

That’s actually a fairly easy problem to fix: just copy the reference number from one of the other notes and paste it in front of the note that’s missing its number. For example, if you copy the number for note 3 and paste it in front of the numberless note 2, you’ll actually get a 2 in front of the note. Microsoft Word is smart enough to know what the number should be.

Usually, the reason a number is missing is because the author has directly deleted the entire text of the note, like this:

When Note Is Deleted Directly

When Note Text Is Deleted Directly

Why Microsoft hasn’t prevented this is beyond me. If the author had deleted the note number up in the main document text, there wouldn’t be a problem.

Typed-In Reference Numbers

Sometimes, in an effort to make notes look “pretty” or meet a certain style, authors will format reference numbers as regular text rather than superscript, then type a period after them. There’s really nothing wrong with that, other than introducing extraneous periods when importing the file into a typesetting program. But some authors actually delete the numbers and type in new ones by hand. You can tell when that has been done by putting your cursor in front of a double-digit note number and pressing the right cursor key. If your cursor moves past the entire number, the number has been automatically generated. But if your cursor moves forward only one digit, the number has been hand-typed.

Again, you could fix the problem by copying an automatic number and pasting it over the hand-typed number, but what if all of the numbers have been hand-typed? Where will you get an automatic number to copy? Simple: just insert a new footnote and copy the number from that. After you’ve finished pasting, delete the extra note (up in the text, remember).

If you have lots of these numbers, you probably won’t want to fix them by hand, so here’s an easier way:

  1. Select all of the notes in the notes pane.
  2. Copy the notes.
  3. Paste the notes at the end of the document.
  4. Using Word’s Find and Replace feature, search for ^f (the code for footnotes) or ^e (the code for endnotes) and replace all of the existing note numbers with a superscript 1. (That will also delete all of the automatic notes in the document.)
  5. Use the “Text to Notes” feature of my trusty NoteStripper add-in to turn the text notes into automatically numbering ones.

“Special” Carriage Returns

Sometimes when editing notes, you’ll try to make a deletion and get the message that “This is not a valid action for footnotes”:

Oops!

Oops!

What that cryptic message should say is “You can’t delete the carriage return that ends a footnote.” The carriage return that marks the end of a note isn’t a regular return; it’s a special return, and you can’t delete it — Word won’t let you. So what often happens is that authors will delete the note text and its reference number, leaving the carriage return behind. But there is a way to get rid of that return: delete its note number up in the main text of the document. If you can’t tell which note number that is, copy the number of a different note and paste it in front of the note’s carriage return. That will give the note a proper number, and you can then delete the note up in the main text. If you have lots of these extraneous carriage returns, you can get rid of them with a macro, as described in “Lyonizing Word: Deleting Extraneous Carriage Returns in Footnotes and Endnotes.”

Microsoft, Are You Listening?

We wouldn’t have such problems with notes if Microsoft would implement just a few changes:

  1. Make it possible to delete a note by selecting the entire note, including the note reference number, the note text, and the “special” carriage return at the end of the note, and then pressing the Delete or Backspace key (which should also remove the note number from the main text). That would keep authors from leaving behind misnumbered notes and extraneous carriage returns.
  2. Provide additional numbering options for the reference numbers in front of the note text, in particular the option to use full-sized numbers followed by a period. That would keep authors from typing in numbers and periods by hand (maybe).
  3. When trying to delete the reference number or carriage return, provide a message that says “Select the entire note before deleting” or “To remove a note, delete the note number in the main text of your document.”

These changes would do a lot to prevent problems caused by authors who don’t know how to properly use Word’s notes. You can help by letting Microsoft know about these needed changes. Give your feedback at Microsoft’s “Welcome to Word’s Suggestion Box!

What about you? Have you seen other odd problems with Word’s notes? If so, how have you solved 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, Wildcard Cookbook for Microsoft Word, and of Macro Cookbook for Microsoft Word. Both books will help you learn more about macros and how to use them.

Lyonizing Word: Why Computers?

by Jack Lyon

Dan A. Wilson, of The Editor’s Desktop, once advised editors that a computer is “far and away your most valuable tool, your ultimate enabler, your brain’s second-in-command. A brain with a pencil in its hand cannot compete — indeed, cannot even credibly challenge — a brain with a computer and computer-sophistication at its disposal.”

Why would that be so? After all, even under the guidance of the most brilliant programmer, a computer can’t ensure that a manuscript has accuracy, clarity, or elegance of expression. But a computer can fix hundreds of mechanical problems that editors shouldn’t have to worry about, and it can do it quickly and consistently.

If something can be automated, then automate it! Let the computer do the heavy lifting. Why is that important? Because it enables you to do more work in less time, and it frees your mind to concentrate on the things that a computer can’t handle (like accuracy, clarity, and elegance of expression). If you’re working for a corporation, that makes you more valuable as an employee (making raises more likely and layoffs less likely). If you’re working for yourself, it enables you to earn more money for the time you put in (as long as you’re charging by the job, the word, or the page, which you should be [see, e.g., On the Basics: Dealing with the Perennial Question of Setting Rates for Our Work]).

Editors working on a computer almost always use Microsoft Word. Love it or hate it (I do both), it is unquestionably the de facto word processor in the publishing world. So how can you use Word to automate whatever can be automated? Here are some suggestions:

  1. Learn to use the full power of Word’s find and replace feature, including wildcards. My Wildcard Cookbook for Microsoft Word will teach you everything you need to know. (No brag, just fact, as we used to say in grade school.)
  2. Learn to record and run macros to automate repetitive editing tasks. My Macro Cookbook for Microsoft Word is a good starting place.
  3. Use Microsoft Word add-ins (like the ones I create at The Editorium) that expand Word’s features to automate various editorial tasks. Let’s look at what some of those add-ins can do to ease your workload.

FileCleaner

We’ll start with one of my most popular add-ins, FileCleaner, which cleans up some of the most common problems in electronic manuscripts, including:

  • Multiple spaces in a row
  • Multiple returns in a row
  • Spaces around returns
  • Double hyphens that should be em dashes
  • Hyphens between numbers that should be en dashes

And much, much more. Here’s a screen shot of the options available:

FileCleaner Options

FileCleaner Options

Want to try it? All of those options are included as part of my Editor’s ToolKit Plus 2014 add-in, which I highly recommend that you download and try. The program offers a 45-day trial period so you can make sure it does what you need before deciding to buy. And if you need help using it, I’m always available by email.

I’d like to point out one special feature of FileCleaner that is frequently overlooked. See that option (under “Formatting”) to “standardize font formats (remove overrides)”? It removes all those odd, inconsistent uses of different fonts that authors like to use, but at the same time it leaves italic, bold, superscript, and styles intact. You won’t believe what a difference this can make in cleaning up a manuscript!

FileCleaner also offers to clean up the active document, all open documents, or all documents in a folder, which means you can run the program on a whole batch of files at once while you go back to reviewing manuscripts (or spending time with family and friends).

Document options

Document Options

Remember all of my talk about automating what can be automated? This is what I’m talking about. Instead of manually doing dozens of find-and-replace routines on dozens of documents, let FileCleaner do the work.

MegaReplacer

FileCleaner is great for cleaning up common problems, but what if you have uncommon problems that you need to clean up? What if you need to go through three dozen documents and change millenium to millennium in all of them, along with dozens of other misspellings (manger to manager, rarify to rarefy, and on and on and on)? That’s what MegaReplacer is for. Again, it works on the active document, all open documents, or all documents in a folder. But unlike FileCleaner, it allows you to define your own find-and-replace items and then run them en masse. You start by creating a list of the items you want to find and replace, with the find item on the left and the replace item on the right, separated by a pipe symbol (|), which you’ll probably find under your backspace key. Your list will look something like this:

millenium|millennium
manger|manager
pubic|public

Save the list as a Word document, and you can use it over and over again.

So far, so good. But you’re not limited to finding and replacing individual words; you can find and replace whole phrases that you’d ordinarily have to fix manually while editing:

at this point in time|now
alright|all right
an historical|a historical
a large number of|many
a small number of|some

To give you even more flexibility, MegaReplacer allows you to specify Match Case, Whole Words Only, both Match Case and Whole Words Only, or Use Wildcards by appending a code to the items on your list:

“+c” for Match Case
“+w” for Find Whole Words Only
“+&” for Match Case and Find Whole Words Only
“+m” for Use Wildcards

Here’s an example of each:

Department|department+c
per|according to+w
Chief|chief+&
p ([0-9]@.))|p. 1+m

To get you started, MegaReplacer comes with a long list of useful corrections that you can modify to meet your needs.

Editor’s ToolKit

The most basic functions of Editor’s ToolKit Plus reside in the section called “Editor’s ToolKit”:

Editors ToolKit Menu

Editors ToolKit Menu

In particular, they automate some of the most common editorial tasks:

Text Features

Text Features

Furthermore, Editor’s ToolKit assigns these tasks to the function keys on your keyboard. Need to italicize (or romanize) a word? Press F8. Want to transpose two words? Press F11. To lowercase a word, press F10.

Please note that these keyboard assignments are the default setting for Editor’s ToolKit, which Rich Adin has correctly pointed out should not be the case (and will not be the case in the next version of the program). You can easily go back to Word’s original settings, however, by clicking the Editor’s ToolKit Plus icon and then clicking “Clear Keyboard Shortcuts.”

Keyboard Shortcuts

Keyboard Shortcuts

But if you find that you like the Editor’s ToolKit keyboard assignments, you can activate them by clicking “Set Keyboard Shortcuts.” The program download includes a keyboard template that lists the default shortcuts; print it out and place it above your function keys, and you’ll have a handy guide to which key does what (remember WordPerfect 5.1?).

The keyboard shortcuts for Editor’s ToolKit are not arbitrary, by the way. I’ve tried to arrange them so that the most common editorial tasks are right at your fingertips. For example, F7 toggles italic on and off. Yes, CTRL + I does the same thing, but after you’ve used F7 a few times, CTRL + I will seem clunky and annoying. Something that small does make a difference in how easily and smoothly you’re able to work in Word (see Lyonizing Word: The Right Tool for the Job and Lyonizing Word: Assigning Macro Shortcut Keys).

Many other features are available from the keyboard, but my favorite is Cap Title Case. To use it, select the text you want to put in title case and press F9. But doesn’t Microsoft Word already have that feature? Yes, it does. But take this example:

The call of the wild

Microsoft Word will turn it into this:

The Call Of The Wild

Editor’s ToolKit will turn it into this:

The Call of the Wild

In other words, Editor’s ToolKit properly handles common articles and prepositions. (The next version of the program will allow you to specify those you want to use.)

All of these are small things, but in the pressure-cooker of day-to-day editing, small things make a big difference in the ease and even the pleasure with which these tiny tasks can be accomplished. I’ve been a working editor since 1978, so I’ve been doing such tasks a long time. I created these tools (and the many others included with Editor’s ToolKit Plus) so that my computer can handle the boring, repetitive, mechanical tasks, allowing me to do the more enjoyable and important work that a computer, no matter how sophisticated, simply cannot do. That, right there, is the reason for computers.

How do you use your computer to make your work easier and faster? I’d love to hear your ideas.

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, Wildcard Cookbook for Microsoft Word, 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 Editor's Toolkit Plus 2014 in a package with EditTools and PerfectIt and 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: 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: 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.

 

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: Finding and Replacing Upper- and Lowercase

Finding and Replacing Upper- and Lowercase

by Jack Lyon

Rich Adin, the proprietor of this blog, recently sent me an interesting question. He wrote:

I need a wildcard find and replace, assuming it can be done by wildcards, that searches for the following

Abrams: alpha
booby: alarm

and replaces it with

Abrams: Alpha
booby: Alarm

That is, the first letter after the colon and space is changed from lowercase to uppercase. I know I can do this by macro, and I have one that will do it, but I would like to do it by wildcard so I can make it part of a script I run.

Unfortunately, there's no good way to do that. Using a wildcard search, we can find any lowercase letter (preceded by a colon and space) by using the following string in the Find What box:

: [a-z]

But in the Replace With box, we should use—what? We can't use the following string because it doesn't specify what the replacement letter should be:

: [A-Z]

In fact, if we try that, Word will simply replace what was found with the string itself, giving us this:

Abrams: [A-Z]lpha
booby: [A-Z]larm

There is, however, a rather sneaky (but ultimately unsatisfactory) workaround. We can replace the lowercase letter with itself formatted as uppercase. Here's how:

1. Press CTRL + H to bring up Word's Replace dialog.
2. If the More button is available, click it.
3. Put a check in the box labeled "Use Wildcards."
4. In the Find What box, enter this:

: [a-z]

5. In the Replace With box, enter this

^&

That's the magic code that tells Word to replace what was found with what was found. In other words, if Word finds ": a" it should replace it with ": a" (the same thing it was searching for). You'll see why in just a minute.

6. Make sure your cursor is in the Replace With box.
7. Click the Format button at the bottom left of the Replace dialog.
8. Click Font.
9. Put a check in the box labeled "All caps."
10. Click OK.
11. Click "Replace All."

That should do the trick; all of our lowercase letters following a colon and space are now formatted as "All caps." The reason I said earlier that this is "ultimately unsatisfactory" is that those letters are not actually uppercase; they merely look as if they're uppercase because of their formatting.

In some situations, that may be good enough. But if your document is destined to be published in a format other than Microsoft Word, it may not be good enough, as formatting may change and, like Cinderella at the stroke of midnight, our "uppercase" letters may revert to their true lowercase selves. (How often do we get to use a fairytale allusion in technical writing?)

The only real solution is to use a macro, like this one:

Sub ReplaceLowercaseWithCaps()
Selection.HomeKey Unit:=wdStory 'Position cursor at top of document
Selection.Find.ClearFormatting 'Clear any
Selection.Find.Replacement.ClearFormatting
With Selection.Find

.Text = ": [a-z]" 'Search for colon and space followed by lowercase letter
.Replacement.Text = "" 'Leave empty--the macro will replace the text later
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True 'Specify a wildcard search

End With
Selection.Find.Execute 'Execute the search
While Selection.Find.Found 'While the search is successful

Selection = UCase(Selection) 'Uppercase what was found
Selection.MoveRight 'Move out of the selection
Selection.Find.Execute 'Try, try again

Wend 'End the "While" loop
End Sub

I've added comments to explain what's going on, but the really pertinent line is this one:

Selection = UCase(Selection) 'Uppercase what was found

When Word finds a colon and space followed by a lowercase letter, it selects the colon, space, and letter (naturally, because it found them), so those are the "Selection." The macro then converts those characters to uppercase using the "UCase" function; it sets the Selection as the uppercased version of the Selection, if you see what I mean.

After that, the macro moves to the right so the text is no longer selected. Then it again executes the Find in an effort to locate the next instance of colon, space, and lowercase letter, if one exists.

And yes, for the sake of simplicity, the colon and space are uppercased here as well as the letter. What's an uppercased colon? A colon. What's an uppercased space? A space. If we wanted to, we could modify the macro to handle each of those separately, but why bother when the result is the same? Virtue in simplicity.

Note that we could do the inverse of this, if we needed to, finding any uppercase letter and lowercasing it. To do so, we'd use ": [A-Z]" for the search string, and we'd modify Selection with the LCase function rather than UCase.

I wish that Microsoft had included a better way to handle this. Even though Microsoft didn't, we now have a way to accomplish what we need to do.

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 “ReplaceLowercaseWithCaps.”
  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 your 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.

Lyonizing Word: Deleting Extraneous Carriage Returns in Footnotes and Endnotes

Deleting Extraneous Carriage Returns
in Footnotes and Endnotes

by Jack Lyon

During my editing career, I've often run into problems with footnotes and endnotes in Microsoft Word. Many authors have no clue about how notes are meant to work, and Microsoft certainly hasn't made it obvious. In fact, they've made it easy to mess notes up beyond repair.

One mistake authors make is to insert extraneous carriage returns before or after a note. Why? Because they don't like the positioning of the note on the page, which they're trying to make "pretty," not understanding the problems that will cause in editing and typesetting.

You can try to remove the extraneous returns like this:

1. Click View > Draft.
2. Click References > Show Notes.

Your cursor should now be in the Notes pane.

3. Click Home > Replace.
4. In the "Find What" box, enter two paragraph codes:

^p^p

5. In the "Replace With" box, enter one paragraph code:

^p

 6. Click the "Replace All" button.

Word will replace some of the double returns, but not all of them. And if you try to delete some of the remaining returns, you'll get an error message:

"This is not a valid action for footnotes."

What's going on there is that not all carriage returns are created equal. Some of the returns are "special" note returns, and the only way to delete them is to delete the note itself back in the text.

The solution? A macro, of course. But a macro with a twist. As we've seen, the macro can't just find double returns and replace them with a single return. And trying to delete extra returns results in an error. So let's use that error!

Before running the macro, you must be in Draft view, with your cursor at the top of the Notes pane. (How to get there is explained above.)

In the macro, you'll see a couple of "comments," which are explanations or instructions intended for the person reading the code. Comments are preceded by a single quotation mark ('), which tells the macro to ignore the rest of the text on that line. For example, the first comment in the macro reads:

'To clean returns in endnotes rather than footnotes, change ".Footnotes" to ".Endnotes" in the following line:

And now, here's the macro:

Sub CleanReturnsInNotes()
'To clean returns in endnotes rather than footnotes, change ".Footnotes" to ".Endnotes" in the following line:
NoteCount = ActiveDocument.Footnotes.Count
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find

.Text = "^p^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False

End With
Selection.Find.Execute
On Error GoTo TrapTheError
While Selection.Find.Found

Selection.MoveLeft
'The following line may trigger an error!
Selection.Delete
Selection.Find.Execute

Wend
GoTo TheEnd
TrapTheError:

ErrorCount = ErrorCount + 1
Selection.MoveRight
Selection.Delete
If ErrorCount < NoteCount Then Resume Next

TheEnd:
End Sub

Let's look at some of those lines.

NoteCount = ActiveDocument.Footnotes.Count

NoteCount is a variable; that is, it's a container that can hold a numerical value—in this case, the number of footnotes in the document. We get that value with the VBA command ActiveDocument.Footnotes.Count.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

Just to be safe, these lines clear any formatting that might already be applied to the "Find What" and "Replace With" boxes in Word's find and replace feature.

The following lines, from

With Selection.Find

down to

Selection.Find.Execute

simply find any instances of double paragraph returns. The replacement text is set to nothing, as we're not trying to replace those returns with anything:

 .Replacement.Text = ""

Instead, we're going to try to delete the second return, which (unless the notes are really messed up) is a regular return rather than a special note return:

 Selection.MoveRight
Selection.Delete

If it's a special note return, then trying to delete it will cause an error, and the macro will execute this line—

On Error GoTo TrapTheError

—which sends the macro to this line:

TrapTheError:

Here's what happens next:

ErrorCount = ErrorCount + 1

Using the variable ErrorCount, we count the number of errors, adding 1 each time we find one. (ErrorCount is initially empty, or zero.)

Selection.MoveRight
Selection.Delete

We move right and delete the next return.

 If ErrorCount < NoteCount Then Resume Next

If the number of errors is less than the number of notes, we're not through yet, as one of the remaining notes may still have a bad return next to it. So, we tell the macro to Resume operation at the next command after the error occurred. That command is:

Selection.Find.Execute

In other words, Word looks for the next occurrence of a double return. And this construction—

While Selection.Find.Found

Selection.MoveLeft
'The following line may trigger an error!
Selection.Delete
Selection.Find.Execute

Wend

—ensures that it will keep looking as long as (While) double returns are found. ("Wend" is short for "While End"—it marks the end of the While construction.)

GoTo TheEnd

When no more double returns are found, this line is executed. It exists simply to avoid executing the error trap (TrapTheError and the following lines) after the macro is finished, at which point

TheEnd:

marks the end of the whole operation.

I hope this explanation has helped you understand better how macros work, and in particular how you can actually use Word errors to force Word to do what you want it to do—something that gives me great pleasure.

Even if you don't understand everything that's going on in this macro, you can still use it to clean up extraneous returns in notes—something that should make your editorial life a little bit easier.

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.