Jack Lyon

Wildcard Secrets Revisited

A few weeks ago I sent out an article called "Three Wildcard Secrets." I thought they were pretty good secrets, too! You can see them here.

In a nutshell, here are the first two:

The wildcard range [A-z], meant to find any uppercase or lowercase letter, will not find accented letters. You have to use [A-Za-z] instead. So I suggested using [!A-z] (not A-z) to find any characters that are accented.

Similarly, if you need to find any unspecified Unicode character, you can use the not range [!^000-^255]. That should work, as 255 is the upper limit on ANSI characters, so anything the range finds must be Unicode.

Then I received a corrective email from macro expert Paul Beverley. The nerve! Here's what Paul had to say about secret #1:

You see the problem? It did what you asked, not what you wanted. It finds any character at all, except A-z.

And Paul is right! The range [!A-z] finds not just accented characters but also spaces, punctuation, and other stuff that isn't letters—something I knew if I'd actually thought about it. You can solve the problem by adding more things that you want to skip. Here's an example:

[!A-z 0-9.,;:\-\?\!^001-^064]

(For more information, see my Wildcard Cookbook for Microsoft Word.)

Next, Paul had this to say about secret #2:

On my PC [!^000-^255] throws up an error:

Now technically, I was right about the range being [!^000-^255]. The problem is that Microsoft Word wants [!^001-^255] instead. And to make things even worse, that wildcard range correctly skips the ASCII characters (numbered 0-126) but incorrectly finds the extended ASCII characters (numbered 127-255), even though we've told it not to. Microsoft strikes again!

But wait, there's more!

  • The range [!^128-^255] gives us the same error message as [!^000-^255].
  • The range [!^127-^255] finds Unicode characters (which it should) and extended ASCII characters (which it should not).
  • The range [!^127-^254] skips extended ASCII characters (which it should) and Unicode characters (which it should not).

All of this weirdness seems to hinge on the points where ASCII becomes extended ASCII, and extended ASCII ends.

Might any of this be useful in your editing work? Yes, if you're using wildcard searches:

  • Use the range [!^127-^255] to find Unicode and extended ASCII characters.
  • Use the range [!^127-^254] to skip Unicode and extended ASCII characters.

That should work, at least until Microsoft decides to fix these problems.

Many thanks to Paul Beverley for his valuable feedback. If you'd like a bunch of free editing macros with instructions on how to use them, you'll want to download Paul's book Macros for Editors.

Three Wildcard Secrets

So, you’ve been using wildcards with Microsoft Word’s Find and Replace feature to save time and ensure consistency as you edit the plethora of freelance work that’s bombarding your inbox. Excellent. But even if you’re getting pretty good at using wildcards, there are actually a few secrets that even many experts don’t know. Maybe you’ll find them useful.

Secret #1

Using the wildcard range [A-z] to find any uppercase or lowercase letter will not find accented letters. Take, for example, the word résumé. [A-z] will find the r, s, u, and m in that word, but it will skip over the two occurrences of é. Go ahead, try it. I’ll be here when you get back.

If you actually want to skip over accented letters, [A-z] might come in handy sometime, but that will rarely be the case. To find all letters, both accented and unaccented, use the wildcard range [A-Za-z] instead. Also, as you might expect, [A-Z] finds both accented and unaccented capital letters, and [a-z] finds both accented and unaccented lowercase letters.

Okay, so [A-z] skips over accented characters; that suggests the idea that we could use a variation on that range to find only accented characters. How? Add an exclamation mark at the beginning of the range, which tells Word to find any character except what is in the range. The modified range looks like this: [!A-z]. Again, using the word résumé, [!A-z] finds the two occurrences of é but skips over r, s, u, and m. If you need to find accented characters, now you know how.

Secret #2

In a wildcard search, you can’t search for Unicode characters using numeric codes (such as ^u945), but you can copy Unicode characters from a document and paste them into Word’s Find box. You can even search for a range of Unicode characters. For example, the range [?-?] from the Greek alphabet (lowercase alpha through omega) finds every character in the Greek greeting ???? ???. You can see the range of characters in various languages by clicking Word’s Insert tab and then the Symbol button on the ribbon:

For example, here, in order, are some of the Cyrillic characters available in Word:

If you need to find any (unspecified) Unicode character in a document, you can use this not range:

[!^000-^255]

That works because 127 is the upper limit on ASCII characters and 255 is the upper limit on ANSI characters. This wildcard string excludes them both, so anything it finds must be Unicode.

Secret #3

You can use the search code ^p to search for paragraph breaks in a regular search, but not with wildcards. If you try, Word will display an error message:

So how do you search for paragraph breaks when using wildcards? Instead of ^p, use ^013. All well and good, but here’s the real secret: In Word’s Replace box, you must not use ^013; instead, use ^p. That’s right:

Find what: ^013

Replace with: ^p

Why? Because Word’s paragraph breaks are not the same thing as an ANSI paragraph break (^013). Word stores all kinds of stuff in paragraph breaks (formatting, for example), and an ANSI break is just a character like any other. I’ve occasionally had to work on documents that came from who-knows-where, and my usual wildcard searches wouldn’t work. I finally realized that those documents were using ANSI paragraph breaks rather than Word’s proprietary paragraph breaks. The solution? Once again:

Find what: ^013

Replace with: ^p

After I replaced the ANSI breaks, my wildcard searches worked again.

Bonus Secret

Microsoft Word’s wildcard search engine uses a modified version of what is widely known as RegEx—short for “regular expressions.” RegEx is more powerful than Word’s version of it, but if you’re feeling geeky, you can actually use RegEx in Word—not in Word’s Find and Replace dialogs but in a macro. If you’re interested, you can learn more here:

http://www.regular-expressions.info/vb.html

I hope you find these wildcard secrets useful. If you’re just getting started with wildcards, please check out my in-depth book on the subject, Wildcard Cookbook for Microsoft Word (ISBN 978-1-4341-0398-7), available at Amazon, Barnes & Noble, and other purveyors of fine technical literature.

Review: Geoff Hart’s Write Faster with Your Word Processor

I've been a fan of Geoff Hart’s books and articles since 2007, when I reviewed the first edition of his book Effective Onscreen Editing. The beauty of that book is that it applies to any software an editor might use. As Geoff explained then, “The overall goal is to teach editing strategies, not specific software.” However, in his latest book, Write Faster with Your Word Processor, Geoff changes his approach in three ways:

  • The book is aimed primarily at writers rather than editors, including writers of fiction. (Geoff is well known for his technical writing, but he’s also the author of several novels and short stories.)
  • The book focuses mainly on writing with Microsoft Word. Why? As Geoff explains, “I’ve provided Word-specific examples because most writers use Word. Moreover, I’ve learned from teaching many workshops that it’s necessary to make general strategies concrete, and Word does a great job of showing how to implement those strategies.”
  • The book isn’t as concerned with being effective as it is with being fast. It’s packed with useful tips and advice to help you spend less time fighting with your computer and more time actually writing. Geoff promises, “I’ll teach you how to improve your existing skills and learn new ones. As you master these skills, you’ll find yourself focusing more on the craft of writing and less on the tools themselves. That means you’ll write better and faster, with less need for revision.”

Like all of Geoff’s books, this one is thorough—I mean really thorough.

Part 1, “Get started,” explains how to personalize your computer to fit the way you work, with an emphasis on something many writers overlook: hardware. Geoff covers:

  • Choosing a good monitor.
  • Choosing a good keyboard.
  • Choosing a good mouse.

I can’t emphasize enough how important these are. But Geoff takes all of this a step further, covering your computer’s overall behavior, keyboard settings, mouse settings, language settings, and display settings. Then he explains how to organize your files, part of the book I'll be reading in more depth (not that I have any problems with organization). Finally, he talks about developing safeguards: security considerations, backing up your work, updating software, protecting your work with passwords, and protecting yourself from computer-related injury and other problems.

Part 2, “Write your first draft,” focuses on getting your words out of your head and into your word processor, again with an emphasis on speed. “Write first, edit later,” as the saying goes. Geoff explains in detail how to develop and use a strong outline (with a nod to those who prefer not to). Then he covers Microsoft Word’s features that are especially useful for writing (including some you probably don’t know about) as well as settings that you might want to change. Out of the box, Microsoft Word is set up to produce business memos and family newsletters; it is definitely not set up for serious writing. But the beauty of Word is that it’s practically infinitely customizable, so why not turn it into a lean, mean writing machine? Here, Geoff explains how.

I’m not going to go into much more detail about what the book includes; you’ll find a detailed table of contents on Geoff's website. I’ll just say that part 3 explains how to revise your writing once you’ve got it down (now it’s time to edit), and part 4 includes more detailed information and resources to help you back up your work and avoid stress injury, as well as a list of helpful keyboard shortcuts. The book ends with a glossary of publishing terms, a link to an online bibliography for those who want more information about a particular area, a collection of helpful internet resources, and an index that, like the rest of the book, is amazingly thorough.

Geoff writes, “My goal is NOT to teach you the writer’s craft; there are many better books for that purpose. The goal is NOT to teach you how Microsoft Word works; Word is just one of many alternatives you can use.” What, then, is the book’s purpose? “My goal,” Geoff says, “is to teach you how to write using a word processor.” And in that, he succeeds beautifully.

Write Faster With Your Word Processor is one of the most comprehensive books I’ve seen about how to write on the computer. At 352 pages (548 for the PDF version, which includes screen shots), it’s not for the faint of heart. But, as Geoff says, “I’ve provided the information in small chunks, designed for easy reading and browsing. You can dip into the book to solve a specific problem, or read it a chapter at a time to increase your mastery.” I’ll be keeping the book near at hand for those very purposes, and I recommend that you do the same.

Geoff makes it easy to buy the book. You can learn more here.

Bibliographic information: Hart, G. 2021. Write Faster With Your Word Processor. Diaskeuasis Publishing, Pointe-Claire, Quebec.

  • Printed version: 352 pages, including index. ISBN 978-1-927972-29-8
  • PDF version (suitable for most tablet computers and very large phones): 548 pages, including index. ISBN 978-1-927972-30-4
  • EPUB version: (unpaginated) ISBN 978-1-927972-31-1

Review: Geoff Hart’s Effective Onscreen Editing, 3rd Edition

Back in 2007, I reviewed the first edition of Geoff Hart’s book Effective Onscreen Editing, which I still keep close at hand on my bookshelf. Why? Because it’s one of the best books ever written about how to edit on a computer, packed with real-world information you’ll find nowhere else.

My own books (such as Wildcard Cookbook for Microsoft Word) are related specifically to a certain piece of software, but the beauty of Geoff’s book is that it applies to any software an editor might use, on either Macintosh or PC (or a Linux box, for that matter). As Geoff explains, “The overall goal is to teach editing strategies, not specific software.” And in that, the book succeeds admirably.

Geoff covers all of the essentials a working editor needs to consider, including the kind of technical matters that most interest me:

  • Personalizing your software
  • Navigating and selecting text
  • Inserting and deleting text
  • Tracking revisions
  • Using comments
  • Using search tools to improve consistency
  • Developing style sheets
  • Using spelling and grammar checkers
  • Automating editing tasks

He also covers business matters, such as:

  • Determining your pay rate
  • Negotiating with clients
  • Dealing with contracts

But Geoff also addresses the ever-important human side of the editing equation, discussing such matters as:

  • Encouraging dialogue and communication
  • Security and confidentiality
  • E-mail alternatives
  • Avoiding repetitive-stress injury and other physical problems

In this new edition, Geoff has added important information about recent developments that I’ve seen covered nowhere else:

  • Collaborative, real-time editing over the Web.
  • Important new software tools for imposing consistency and applying publisher style requirements.
  • Proofreading PDF files, online documents, and Web pages.

You’ll find more information about the new edition here. And you’ll find a detailed table of contents here.

If you’re a working editor, you owe it to yourself to buy and read this book, which is available in print, as a nicely formatted and hyperlinked PDF, and as an ebook (free with the PDF) for use with small tablets and smartphones. I make no money from the sale of this book; I'm just an ardent fan. As I said of the first edition, I give it my highest recommendation. And besides, as an excellent writer and a respected teacher known for generously sharing his expertise, Geoff deserves your support. You can purchase the book here.

Many thanks to Geoff for creating this wonderful resource.

Hart, G. 2016. Effective onscreen editing: new tools for an old profession. 3rd ed. Diaskeuasis Publishing, Pointe-Claire, Quebec.
Printed version: 518 p. ISBN 978-1-927972-04-5
PDF version (suitable for most table computers): 827 p. ISBN 978-1-927972-05-2
EPUB version: (unpaginated) ISBN 978-1-927972-06-9

 

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.

Macros for Macs!

In Word 2008 for Macintosh, Microsoft removed all macro capability. In Word 2011 for Macintosh, Microsoft brought it back—sort of. The capability is there, but compatibility with Word for Windows is somewhat lacking. And that's why the programs from the Editorium have not been available for Word 2011.

I'm pleased to report, though, that our FileCleaner program is, at last, available for Word 2011 on Macintosh. You can download the program by clicking here.

FileCleaner cleans up common problems in electronic manuscripts, including multiple spaces, multiple returns, unnecessary tabs, improperly typed ellipses, ells used as ones, and much more. It turns double hyphens into em dashes, and hyphens between numerals into en dashes. It can also remove directly applied font formatting (such as Times 12 point) while retaining styles (such as Heading 1) and character formatting (such as italic and bold). The program includes batch processing so you can clean up all open documents or a whole folder full of documents to maximize your productivity, doing in minutes what used to take hours to do by hand. This new version also includes the option to track the changes made while cleaning up.

This is a major new version of FileCleaner that has taken much time and expense to create. For that reason, users will need to purchase a new license for the program, even if they already have a license for the previous version. (A previous password/registration code will not work.) But at $29.95 it's a bargain. The program will pay for itself the first time you use it on any substantial editing job. Then it will pay for itself again on the next job. And the next. Out of all of our programs, this is the one I use most. It's a real workhorse that every serious editor should have.

You can, of course, try the new version for 45 days to make sure it does what you need. After that, you'll need a password/registration code to keep the program from timing out. When you're ready to buy a license for the new version, you can do so by clicking this link.

I'd also be grateful for any feedback you'd care to provide after trying the new version.

Now that I have most of the kinks worked out on the Macintosh, our other programs will also become available, one by one, in the near future. Next up: NoteStripper. Thanks for your patience!

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.

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.