Getting a Bird’s-Eye View on Your Document

By Jack Lyon, the Editorium

Back in the days of editing on paper, I would sometimes spread manuscript pages out on my desk to get a bird's-eye view of the text I was working on. This could be useful for several reasons:

  • To see if long stretches of text needed to be broken down into subsections.
  • To compare points made over here with other points made over there.
  • To see if the overall organization of a chapter made sense.

On a computer screen, the default view is one page at a time, and most editors rarely deviate from that, even though it's possible (and sometimes useful) to do so. Here's how:

  1. On Microsoft Word's ribbon, click the View tab.
  2. Click the Zoom button.

img

  1. Click the Many pages button and select 2 × 4 Pages, which is the maximum Word allows when setting the number through the ribbon.

img

  1. Click the OK button.

Your document's pages should now be displayed four across, and if it has more than eight pages, they will automatically be displayed in more rows than the two you specified.

img

It's a bird's-eye view! After looking around, you can place your cursor anywhere on one of the pages and then click Zoom > One page to work on that page. Very convenient!

If you want to display more than four pages across, you can do so with a macro. This one will give you ten pages across:

Sub BirdsEyeView()    
    With ActiveWindow.ActivePane.View.Zoom
        .PageColumns = 10
        .PageRows = 2
    End With
End Sub

You can change the ".PageColumns = " number to anything you like, but 25 appears to be the maximum that Word will accommodate.

To return to Word's default view of one page, click Zoom > One page.

Here's how to use the BirdsEyeView macro and put in on Word's Quick Access Toolbar for easy use:

https://editorium.com/archive/how-to-add-a-macro-to-word-and-its-qat-quick-access-toolbar/

How about you? Do you have better ways of getting a bird's-eye view of your work? If so, I'd love to hear from you.

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.

Wildcard Cookbook for Microsoft Word

Wildcard Cookbook for Microsoft Word

If you're editing or writing in Microsoft Word, you need to understand Word’s advanced search features. These features are extremely powerful, but they’re also virtually undocumented; most explanations of their use have been limited to a simple table of wildcards. My new book, Wildcard Cookbook for Microsoft Word, explains in detail how you can use these powerful tools to blaze through repetitive problems that would take hours to correct by hand. It covers:

  • Using Word’s find and replace options (yes, all of them—including the hidden ones).
  • Finding and replacing with Word’s built-in codes (for dashes, page breaks, and much more).
  • Finding and replacing with numeric character codes (ASCII, ANSI, and Unicode—when regular letters and numbers aren't enough).
  • Finding and replacing with wildcards, including wildcard ranges, wildcard groups, and the powerful “Find What Expression” wildcard. (This is the good stuff, the real meat of this book.)

The book explains all aspects of finding and replacing in Microsoft Word, with numerous examples of wildcards used to fix real-world documents, wildcard tips and techniques from readers of Editorium Update newsletter, a reference section for ease of use, and a thorough index.

Although I write and sell Microsoft Word macros for a living, the tools I depend on most are Word's advanced find and replace features. Learning to use these tools takes time and effort, but the payoff is huge. I hope this book will help you use these tools to streamline your work, save time, and make more money!

Daniel Heuman, CEO and founder of Intelligent Editing, sent me the following unsolicited comment:

This. Is. Amazing. What a brilliant, brilliant idea! I've actually been directing people to your wildcard freebie page lately. But this is so much better! The world has needed this book for a while!

Thank you, Daniel! The book is now available at Barnes & Noble, Amazon, and other online retailers.


Resources

Wildcard Cookbook for Microsoft Word is a fairly small (but value-packed) book (114 pages, 5.5 by 8.5 inches). My big book, Microsoft Word for Publishing Professionals (632 pages, 7 by 10 inches) is now available as a free download from Intelligent Editing. All you need to do is sign up for Daniel Heuman's free newsletter, which covers a wide range of topics and provides free tips for authors and editors. I subscribe, and I think you should too. When you do, you'll get Microsoft Word for Publishing Professionals as a hyperlinked, searchable PDF, perfect for easy reference in handling those tough Microsoft Word problems.

Note: The PDF includes a secret special offer right after the front cover. I won't tell you what it is; you'll need to find out for yourself. But I think you'll like it!

Better word processing: The Chicago Manual of Style interview

The Chicago Manual of Style "Shop Talk" column recently noted:

"When it comes to word processing, CMOS users probably represent every level of expertise (or nonexpertise), but regardless of skill level, we all experience frustration at times when we don’t know how to accomplish a task on our computers. Often we do something the way we’ve always done it—the slow way—because it just seems too difficult or scary to try to automate it. Is there a cure?"

There is a cure, as I explain in my interview with CMOS "Shop Talk." I grew up as a book editor by following the Chicago Manual of Style, so it was a real thrill for me to do the interview. I hope you'll find it interesting and useful.

Best wishes,

Jack Lyon

Spelunking in Microsoft Word

Laura Poole's Editorial Bootcamp

Before getting into today's main article ("Spelunking in Microsoft Word"), I want to mention a great resource: master copyeditor Laura Poole's Editorial Bootcamp, which covers everything from style guides and software to style sheets and spelling. I had the good fortune to sit in on one of Laura's sessions at this year's Communication Central conference. I sat down, buckled myself in, and set my brain to "absorb"! And wow, what a ride! Laura's training is fast, furious, and thorough—serious training for serious editors. Here's what Laura herself has to say:

The Editorial Bootcamp offers live and virtual training for copyeditors, proofreaders, groups, and publishers. With a variety of training topics available, you can find a course for you or have one customized for your organization. We have many years of experience in scholarly publishing and freelancing, and we work hard to impart useful, practical knowledge to attendees. Please see http://www.editorialbootcamp.com for details and information. 

If you need editorial training from the ground up, or just need to brush up your skills, I highly recommend Laura's services.

And now, let's go spelunking!

Spelunking is the recreational pastime of exploring caves. It’s a dark and dangerous hobby, an extreme sport for those who are confident in their ability to climb, navigate, and even swim (there’s usually water down there).

I try to avoid such hazards, but I’m not afraid to explore some of the deeper reaches of a computer program—Microsoft Word, for example. That’s one reason I know quite a bit about that particular program. Some of my friends, however, seem terrified of making a “mistake” on the computer. They want a concrete series of steps to follow in everything they do. “How can I make a word bold?” they ask. I reply:

  1. Double-click the word to select it.
  2. Click the “Bold” icon on the Ribbon.

Then they say, “Oh, that’s wonderful! Let me write that down for next time.”

There’s nothing inherently wrong with learning to use a computer in that way, and those who are comfortable with that should keep a big Microsoft Word reference book close at hand. These are probably the same people who would enjoy taking a guided tour of Timpanogos Cave, which is about an hour away from where I live.

But that’s a far cry from spelunking, and I doubt that any of the people on the tour discover something new.

So what kind of a person are you? Do you like someone to hold your hand along the well-marked trail? Or would you rather descend into the dark depths of the cavern with only a flashlight as your guide? Either way is fine, but sometimes it’s nice to get off the beaten path; you never know what you might find. As Henry David Thoreau once said, “Nature abhors a vacuum, and if I can only walk with sufficient carelessness I am sure to be filled.”

Want to learn something new about Word? Try exploring Word’s features that aren’t on any menu, the caverns that aren’t on the map. Here’s how:

  1. Press ALT+F8 to open the Macros dialog.
  2. Click the dropdown list next to “Macros in.”
  3. Select “Word Commands.”

Now, in the window under “Macro name,” you’ll see all of the commands available in Microsoft Word, whether they’re on the Ribbon or not. If you click one, you’ll see a description of its function under “Description,” at the bottom of the dialog. These descriptions are minimal at best, but along with the name of the command, they’ll give you some idea of what the command does. You can also click the “Run” button to run the command, which may give you even more insight. (Be sure to do this only with a junk document; you don’t want mess up an actual project.)

Let’s take a look. Don’t be afraid; I’ll be right behind you all the way.

So we’re scrolling through the list of Word commands in Word 2013, and what do we see? “CharacterRemoveStyle,” which, according to its description, “Clears character style from selection.” What?!? Does this mean it’s possible to remove a character style without affecting text-level formatting (such as italic)? If so, I sure didn’t know about it. Let’s find out. We type a junk sentence into a junk document:

This is a test to see what will happen.

We apply italic formatting to “test” and the character style “Emphasis” character style to “see”:

This is a test to see what will happen.

The formatting of those two words looks the same, but the formatting is not the same. Now let’s see if the “CharacterRemoveStyle” command works. We select the sentence, press ALT+F8, scroll down to “CharacterRemoveStyle,” and run it. Look at that! Our test sentence becomes:

This is a test to see what will happen.

The character style is gone, but the text-level formatting is still there. Neat!

Okay, one more, and then we’ll go back up to the surface. Down, down, down, scrolling, scrolling, scrolling. What’s this? “RestoreCharacterStyle.” I’ve never noticed that command before. The description says “Restores character style and removes direct formatting.” Could this be the inverse of the command we just finished exploring? Again we type our junk sentence and apply the same formatting as before:

This is a test to see what will happen.

Then we select the sentence and run the “RestoreCharacterStyle” command. Yes! The sentence now looks like this:

This is a test to see what will happen.

The text-level formatting is gone, but the character style remains!

But why does Microsoft say that this command restores a character style? If we remove the character style from our sentence and then run the command, does the character style come back? A quick experiment shows us that no, it doesn’t. Then why the odd name? I suspect that under the hood, Word is removing all character-level formatting but then restoring any formatting applied with a character style. It’s the equivalent of (1) identifying the character style, (2) pressing CTRL+SPACEBAR (to remove character-level formatting), and then (3) reapplying the character style — which means that the command was named from the programmer’s perspective rather than the user’s perspective. There’s a lot of stuff like that down here in the dark, and it’s part of what makes exploring so interesting.

Back up in the daylight, we assess our adventure, which I’d have to say has been a success. We’ve discovered two commands we didn’t know about before. Could they be useful in our actual editing work? Yes, indeed!

Personally, I enjoy crawling around down there in the bowels of Microsoft Word. Yes, it’s dark and it’s dirty, and sometimes I find something nasty under a rock. But I also make lots of interesting discoveries, and I nearly always learn something new.

How about you? Ready to go spelunking on your own? Have fun, and don’t forget your flashlight!

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.

Removing Spaces at the End of Table Cells

Authors do funny things. Sometimes these things are inadvertent; sometimes they’re the result of trying to “prettify” documents for publication. In either case, editors have to clean up what the authors have done.

One such problem is spaces at the ends of table cells. A table cell should end with the text it contains. If there are spaces after that text, they can cause alignment (and other) problems if they’re allowed to persist into typesetting.

It should be a simple matter to clean up the extraneous spaces: Search for a space followed by an end-of-cell marker and replace with just an end-of-cell marker. But what magic code can we use to find or replace an end-of-cell marker? As it turns out, there isn’t one. But we can still get rid of those spaces with a macro. Here it is, with comments about what’s going on (text following a single quotation mark is a “comment”, which is also in green for clarity):

The Macro

Sub CleanCellEndSpaces()
'Define variables (that is, containers for information)
 Dim aTable As Table
 Dim aCell As Cell
 Dim aRow As Row
 Dim aColumn As Column
 Dim aRange As Range 'A specific area of the document
 Dim aLen As Integer 'A number
 Dim LastChar As String 'A string of characters (text)
Dim Tracking As Boolean 'True or False
 Tracking = ActiveDocument.TrackRevisions 'Get setting of revision tracking
 ActiveDocument.TrackRevisions = False 'Turn off revision tracking
On Error Resume Next 'In case of tables with "vertically merged" cells
 'Cycle through tables, rows, and cells
For Each aTable In ActiveDocument.Tables
 For Each aRow In aTable.Rows
 For Each aCell In aRow.Cells
CheckAgain:
Set aRange = aCell.Range 'Set aRange variable to the contents of the current cell
 aRange.End = aRange.End – 1 'Don’t include the end-of-cell marker
 aLen = Len(aRange.Text) 'Get the length of the cell’s text
 aString = aRange.Text 'Assign the text to a variable
 LastChar = Right(aString, 1) 'Get the last character of the text
 If LastChar = " " Then 'If the last character is a space
aRange.Text = Left(aRange.Text, aLen – 1) 'Set the text to be itself minus the trailing space
 GoTo CheckAgain 'Go back and check for another space (there may be several)
End If
 Next aCell
 Next aRow
 Next aTable
ActiveDocument.TrackRevisions = Tracking 'Set revision tracking back to its original state

End Sub

The Explanation

Here’s how the macro works.

We start by “dimensioning” (defining) our variables, like this:

Dim aTable As Table

“aTable” is an arbitrary name; I just made it up. But that whole line tells Word that aTable will represent a table in our document. The other “Dim” statements follow suit, with “aCell” representing a table cell, “aRow” representing a table row, and so on.

These three lines deserve special attention:

Dim Tracking As Boolean
 Tracking = ActiveDocument.TrackRevisions
 ActiveDocument.TrackRevisions = False

Dimensioning the “Tracking” variable as Boolean tells Word that the variable will be either true or false; those are the only two values it can hold.

Next, we set “Tracking” to the value of ActiveDocument.TrackRevisions. If revision tracking is on, “Tracking” will be set to “True.” If revision tracking is off, “Tracking” will be set to “False.” We do that to remember the current setting for revision tracking, because the next line, “ActiveDocument.TrackRevisions = False” actually turns revision tracking off (we’ll reset it later). This is necessary because (1) tracking the deletion of those extraneous spaces isn’t needed, and (2) using revision tracking may send this macro into an endless loop as it keeps “finding” the character that it just deleted (but is still there as a tracked revision).

The next line —

On Error Resume Next

— needs to be there in case a table includes “merged” cells, which will cause an error when the macro runs. If that happens, the macro will skip to the next line, which means that tables with “merged” cells will be ignored. There may be a better way to deal with such tables, but I don’t know what it is.

After that line, things get really interesting:

For Each aTable In ActiveDocument.Tables

This tells Word to work on “Each” table in ActiveDocument.Tables. “What’s that?” you ask. Well, obviously “ActiveDocument” is the active document — the document that’s open in Word with our cursor moving around in it. (Other documents may be open but not active.) In the active document, there’s a collection of objects called “Tables” — which are, of course, the tables in the document.

And now, a brief digression: As far as macros are concerned, a Microsoft Word document is “simply” a collection of various objects, such as tables, headers, footers, footnotes, endnotes, paragraphs, words, and much, much more. All of these objects have certain “properties.” For example, a paragraph may have the property of FirstLineIndent set to “True” — in other words, its first line is indented. Objects can also contain other objects. For example, a table always contains at least one row and one column. So, in our macro, we have this:

For Each aRow In aTable.Rows

That tells Word to work on each row in the current table. Similarly, this —

For Each aCell In aRow.Cells

— tells Word to work on each cell in the current row.

Next, we’re going to set the range of text we want to use (that is, aRange) to be the current cell:

Set aRange = aCell.Range

Then we’ll reduce the end of that range by one character, so we don’t include the end-of-cell marker:

aRange.End = aRange.End – 1

And, using the Len command, we’ll find out the length (number of characters) included in the range’s text:

aLen = Len(aRange.Text)

Now let’s get that text by putting it into the variable called “aString”:

aString = aRange.Text

And we’ll use the Right command to find out the last character of the text string (that is, the first character on the right of the string):

LastChar = Right(aString, 1)

That looks a little complicated, but it’s actually fairly simple. Let’s say our text string is “Hi, Mom!” The “1” tells the Right command at which character to start counting (from the right of the string). In other words, LastChar is assigned the last character of the string, which in this case is an exclamation mark (“Hi, Mom!”).

But what if the last character is a space? That’s what we really we want to know. The next line will tell us if that’s the case:

If LastChar = " " Then

If the last character is a space, we need to get rid of it, which we can do like this:

aRange.Text = Left(aRange.Text, aLen – 1)

That line changes the text of our range to itself minus its last character (if the previous line identified its last character as a space). But what if there’s more than one space? We want to get rid of those spaces too! And that’s where the next line comes in:

GoTo CheckAgain

That sends the macro back to the “label” we’ve created at this line:

CheckAgain:

And the operation is repeated on the cell until no more spaces remain at the end of the cell.

All of the “Next” commands that follow repeat the whole operation for every cell in every row in every table of the active document. Powerful stuff!

Finally, the macro restores revision tracking to its original setting as stored in the “Tracking” variable:

ActiveDocument.TrackRevisions = Tracking

As they taught us in kindergarten, it’s good to clean up after yourself.

This article is a brief introduction to manipulating Word “objects” with macros. Future articles may explore more of those objects, along with their “properties” and “methods.” If that’s more than you want to know, you may still find the macros themselves to be useful.

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.

Programs from the Editorium

Have you checked out the Editorium's latest Microsoft Word add-ins to help with your work?

IndexLinker creates hyperlinks from index page numbers back to the text to which they refer. If you're creating ebooks or PDFs with indexes, you need this program.

BookMaker automates typesetting and page layout in Microsoft Word. Stop fighting with page breaks, headers, and footers. Let BookMaker do the heavy lifting.

LyXConverter converts Word documents into LyX documents.

And, of course, many other useful add-ins are available as well, including Editor's ToolKit Plus.

A Special Deal: Editor's Toolkit Ultimate!

Editor's ToolKit Ultimate combines three great products:

The three products work together to create a powerful editing package to take you through three separate stages of copyediting.

Communication Conference

Wondering how to launch or improve an editorial business, whether you offer writing, editing, proofreading, indexing or other related services? Come to “Be a Better Freelancer! (Re)Invent Your Business,” the ninth annual Communication Central conference for freelancers, September 26–27, 2014, in Rochester, NY, with an Editorial Bootcamp on September 28 at the same location.

Topics include launching your business, macros and other efficiency/productivity tools, working with MS Office, organization tips, a self-publishing roundtable, balancing freelancing and family life, resources, benefiting from social media, and more. Keynote speaker is Jake “Dr. Freelance” Poinier. Other speakers include Erin Brenner, Ally Machate, April Michelle Davis, Daniel Heuman, Katharine O’Moore-Klopf, Dick Margulis, Greg Ioannou, Geoff Hart, Jack Lyon, Laura Poole, Ben Davis, Amy Schneider, and Ruth E. Thaler-Carter.

Interested in Laura Poole’s editorial bootcamp? Info for the Editorial Bootcamp is included in the conference registration PDF. The Editorial Bootcamp may be taken without attending the conference.

You'll find more information here:

http://www.communication-central.com/

Questions? Contact Communication Central owner Ruth E. Thaler-Carter, at conference@communication-central.com or 585-248-0318.

Deleting Extraneous Carriage Returns in Footnotes and Endnotes

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, you can’t just find double returns and replace them with a single return (even in a macro). 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. They are usually displayed in green. 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.

How to Add the Macro to Word and to the QAT (Quick Access Toolbar)

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 “CleanReturnsInNotes.”
  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.

Programs from the Editorium

Have you checked out the Editorium's latest Microsoft Word add-ins to help with your work?

IndexLinker creates hyperlinks from index page numbers back to the text to which they refer. If you're creating ebooks or PDFs with indexes, you need this program.

BookMaker automates typesetting and page layout in Microsoft Word. Stop fighting with page breaks, headers, and footers. Let BookMaker do the heavy lifting.

LyXConverter converts Word documents into LyX documents.

And, of course, many other useful add-ins are available as well.

A Special Deal: Editor's Toolkit Ultimate!

Editor's ToolKit Ultimate combines three great products:

The three products work together to create a powerful editing package to take you through three separate stages of copyediting.

The Law of Least Surprise

I wear many hats, but two of my favorites are my editing hat (really just a green-celluloid visor that protects my eyes from the glare of the lightbulb dangling overhead) and my programming hat (a rakish fedora with a feather on the side). I alternate between the two on any given day, but there's one guiding principle that both hats share—the law of least surprise.

The law of least surprise was formulated by computer nerds who wisely realized that "a programmer should try to think of the behavior that will least surprise someone who uses the program, rather than the behavior that is natural from knowing the inner workings of the program." For example, if I'm writing a document in a word processor, and I type "3rd" (meaning "third"), the "rd" should not magically be formatted as superscript. But that's the default setting in Microsoft Word, which frequently violates the law of least surprise, often in very big ways.

One of the most egregious violations occurred with the introduction of the Document Map in Word 97. The feature didn't work unless heading styles were applied to headings in the document text. If it couldn't find any headings, it created them, automatically formatting short lines that looked as though they might be headings.

Another bad one was the universally hated "Clippy," the animated paperclip also introduced in Word 97. (Is there a pattern here?) Clippy would pop up at the most inopportune times, "helpfully" saying things like "It looks as though you're writing a grocery list. Do you need milk?" In 2007 Smithsonian magazine called Clippy "one of the worst software design blunders in the annals of computing." In 2010 Time magazine listed it as one of the 50 worst inventions. Even at Microsoft, Clippy's internal code name was "TFC," which did not stand for "that friendly clip." Nevertheless, I enjoy some of the creative spoofs that Clippy inspired.

The law of least surprise isn't just for programmers, though. It also applies to editors, who should change an author's text as little as possible while still ensuring clarity (and, in some situations, conformity to house style). I've had bad experiences with inept but well-meaning proofreaders who made changes because something I wrote didn't follow the "rules" or because they had a "better" way to express something than I did, even though my way was perfectly clear. This reminds me of a story about Abraham Lincoln:

A Cabinet meeting was called to consider [the United States'] relations with England. . . . One after another of the Cabinet presented his views, and Mr. Seward read an elaborate diplomatic dispatch, which he had prepared.
Finally Mr. Lincoln read what he termed "a few brief remarks upon the subject,'' and asked the opinions of his auditors. They unanimously agreed that our side of the question needed no more argument than was contained in the President's "few brief remarks.''
Mr. Seward said he would be glad to adopt the remarks, and, giving them more of the phraseology usual in diplomatic circles, send them to Lord Palmerston, the British premier.
. . . The President, half wheeling in his seat, threw one leg over the chair-arm, and, holding the letter in his hand, said, "Seward, do you suppose Palmerston will understand our position from that letter, just as it is?"
"Certainly, Mr. President."
"Do you suppose the London Times will?"
"Certainly."
"Do you suppose the average Englishman of affairs will?"
"Certainly; it cannot be mistaken in England."
"Do you suppose that a hackman out on his box (pointing to the street) will understand it?"
"Very readily, Mr. President."
"Very well, Seward, I guess we'll let her slide just as she is."
And the letter did "slide," and settled the whole business in a manner that was effective. (Alexander K. McClure, Yarns and Stories of Abraham Lincoln [Salt Lake City: Waking Lion Press, 2013], 160-61.)

When editors make changes not to ensure clarity but to meet some arbitrary aspect of their own sensibilities, they're doing it wrong. As an editor, I try to keep that in mind. And as an author, I don't like surprises.

New Programs from the Editorium

Wearing my programmer's hat, I've been working hard all summer to create some new Microsoft Word add-ins to help with your work:

IndexLinker creates hyperlinks from index page numbers back to the text to which they refer. If you're creating ebooks or PDFs with indexes, you need this program.

BookMaker automates typesetting and page layout in Microsoft Word. Stop fighting with page breaks, headers, and footers. Let BookMaker do the heavy lifting.

LyXConverter converts Word documents into LyX documents.

A Special Deal: Editor's Toolkit Ultimate!

Editor's ToolKit Ultimate combines three great products:

The three products work together to create a powerful editing package to take you through three separate stages of copyediting.

Editing Documents in LaTeX

Do you ever have to edit a document written in LaTeX? There’s recently been some discussion on Copyediting-L about how to do this. I know of three methods.

Method 1: Work in raw LaTeX

LaTeX looks like this:

chapter[On the Origin and Design of Government]{On the Origin and Design of Government in General, with Concise
 Remarks on the English Constitution}
 Some writers have so confounded society with government, as to leave
 little or no distinction between them; whereas they are not only
 different, but have different origins. Society is produced by our
 wants, and government by our wickedness; the former promotes our
 happiness emph{positively} by uniting our affections, the latter
 emph{negatively} by restraining our vices. The one encourages
 intercourse, the other creates distinctions. The first is a patron, the
 last a punisher.

As you can see, formatting and document structure are implemented with codes. That's okay; just don't mess with the codes unless you know what you're doing. You can open a LaTeX document in any text editor and start editing. When you're finished, save the file and return it to the authors.

But what if your authors need to see your revisions? In that case, a text editor isn't going to work. But Microsoft Word has revision tracking . . .

Method 2: Edit in Microsoft Word

There are ways to turn a LaTeX file into a Word document, but that's probably not what your authors want. Nevertheless, you can still edit in Word, using revision tracking. Here's how:

  1. Open the LaTeX file (extension .tex) in Word.
  2. Save the file as a Word file (extension .doc or .docx).
  3. Turn on Track Changes.
  4. Edit the text, being careful not to change any of the LaTeX coding.
  5. Don't use any of Word's formatting features (paragraph styles, italic, bold, and so on), which will be lost when the document is changed back to a text file (which, later, it will be).
  6. Save the Word file and send it back to your authors, who should review the file in Word so they can accept or reject your changes.

After all of the changes have been either (1) accepted or (2) rejected (in other words, so that all tracked changes have been taken care of), the authors should do this:

  1. Save the file as a text file (extension .txt).
  2. Change the .txt extension to .tex.

At that point, they should be able to compile the LaTeX file as usual.

Method 3: Edit in LyX

LyX is a graphical user interface for LaTeX, with its own version of revision tracking. Here's the procedure:

  1. You (the editor) install LyX. Unless you're planning to use LyX for typesetting, you just need the simple installer rather than the bundled version.
  2. Import the authors' LaTeX file into LyX (File > Import > LaTeX).
  3. Do your editing in LyX, using its revision-tracking feature (Document > Change Tracking > Track Changes).
  4. Ask your authors to review your changes in LyX and accept or reject as needed.

At that point, your authors can (1) export the file as LaTeX (File > Export > LaTeX) or (2) process the file from within LyX. If you want to use this method, you should do some back-and-forth testing with your authors before starting work on an actual manuscript.

If you find that you like working in LyX (I do), you may sometimes need a way to convert a Word document into a LyX document, which is not an easy task—unless you use my new Microsoft Word add-in, LyXConverter. I do not, however, recommend trying to round-trip a document—that is, convert a Word document into LyX and then back into Word. Again, there are ways to do it (via OpenOffice.org Writer), but how reliable the final conversion might be is open to question.

How about you? Do you get manuscripts in formats other than Word? If so, how do you handle them? Please let me know!

Deleting Multiple Comments

While editing in Word, you may use Word's Comments feature (Insert > Comment) to insert questions for your client--or possibly your client has used comments to insert questions for you. In either case, there will probably come a time when you need to remove the comments so the file can be used for typesetting. But deleting comments one at a time can be a real pain.

The solution? A trusty macro, of course. Here's a simple macro that will delete all the comments in a document:

Dim aComment
For Each aComment In ActiveDocument.Comments
aComment.Delete
Next

If you don't know how to use such macros, you'll find instructions here:

http://lists.topica.com/lists/editorium/read/message.html?mid=1706922855

But what if there are comments you don't *want* to delete? For example, what if the only comments you want to remove are the ones you created? The following macro will do the trick:

Dim aComment
For Each aComment In ActiveDocument.Comments
If ActiveDocument.Comments(1).Initial = "JML" Then
aComment.Delete
End If
Next

Just put your own initials in the macro in place of "JML" and off you go--comments deleted; problem solved.

_________________________________________

RESOURCES

Making Word Work for You: An Editor's Intro to the Tool of the Trade, by Hilary Powers

ISBN: 978-1-880407-22-6

If you've spent much time in user groups related to Microsoft Word and freelance copyediting, you're probably familiar with the helpful and distinctive postings from Hilary Powers, an expert word-whacker and one of the most respected and successful freelancers I know. When Hilary talks, people listen. And now for the big news: Hilary has released her long-awaited book, Making Word Work for You! You can learn more about the book here:

http://www.the-efa.org/res/booklets.html

Here's the "official" description: "Successful freelance editor Hilary Powers explains how to get the most out of Microsoft Word when editing manuscripts on screen. Among the subjects she covers are personalizing the program and the screen to meet your needs and taste, deploying Word's custom features, domesticating Track Changes, creating and using macros and templates, coping with the snares and pitfalls Word users often encounter, and finding useful resources and program add-ins. With this guidance, editors can increase their page-per-hour throughput--and their income."

Making Word Work for You is available from the Editorial Freelancers Association as a printed booklet and as a downloadable PDF file, both for a price that is less than a lunch at the food court in the mall. If your time is worth anything, you *must* read this book. Nobody--and I mean nobody--understands how to wring productivity out of Microsoft Word the way Hilary does. Don't wait--get this book *now* and follow Hilary's advice. You'll be glad you did. You can buy the book here:

http://www.lulu.com/content/1175135

Many thanks to Hilary for providing such a valuable resource.