Lyonizing Word: Shifting Styles

Shifting Styles

by Jack Lyon

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

Automatically Update Document Styles

The Problem

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

The Solution

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

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

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

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

Automatically Update Styles

The Problem

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

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

The Solution

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

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

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

So here’s my recommendation:

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

Styles Based on Styles

The Problem

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

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

The Solution

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

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

Problem solved.

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

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

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

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

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

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

AutoFormat Headings

The Problem

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

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

The Solution

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

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

Define Styles Based on Your Formatting

The Problem

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

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

The Solution

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

Problem solved — no more proliferation of unwanted styles.

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

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

The Business of Editing: Wildcarding for Dollars

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

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

Identifying the What Needs to Be Wildcarded

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

references as received

references as received

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

references after wildcarding

references after wildcarding

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

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

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

The Wildcard Find

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

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

Wildcard Interface

Wildcard Interface

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

Wildcard Dataset Dialog

Wildcard Dataset Dialog

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

The Effect of Clicking Select

The Effect of Clicking Select

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

Creating Our String

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

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

What we have for the first name in the list is

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

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

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

Wildcard First Steps

Wildcard First Steps

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

How many letters?

How many letters?

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

How this part looks in wildcardese

How this part looks in wildcardese

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

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

Manually adding the next part

Manually adding the next part

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

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

Selecting UPPER CASE from the Characters Menu

Selecting UPPER CASE from the Characters Menu

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

A Quantity of 1

A Quantity of 1

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

The rest of the Find criteria

The rest of the Find criteria

The Wildcard Replace

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

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

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

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

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

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

Select Wildcard

Select Wildcard

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

Use Find Criteria dialog

Use Find Criteria dialog

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

The completed wildcard macro

The completed wildcard macro

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

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

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

Spend a Little Time Now, Save Lots of Time Later

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

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

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

Richard Adin, An American Editor

Related An American Editor essays are:

_________________________

Looking for a Deal?

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

Lyonizing Word: The Right Tool for the Job

The Right Tool for the Job

by Jack Lyon

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

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

The Wrong Tools

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

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

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

Jack Lyon Graphic 1

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

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

Jack Lyon Graphic 2

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

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

The Right Tools

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

Jack Lyon Graphic 3

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

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

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

Add-In Tools

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

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

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

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

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

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

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

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

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

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

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

Lyonizing Word: Finding and Replacing Upper- and Lowercase

Finding and Replacing Upper- and Lowercase

by Jack Lyon

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

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

Abrams: alpha
booby: alarm

and replaces it with

Abrams: Alpha
booby: Alarm

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

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

: [a-z]

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

: [A-Z]

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

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

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

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

: [a-z]

5. In the Replace With box, enter this

^&

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

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

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

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

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

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

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

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

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

Wend 'End the "While" loop
End Sub

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

Selection = UCase(Selection) 'Uppercase what was found

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

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

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

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

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

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

________

How to Add Macro to Word & to the QAT

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

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

To actually use the macro:

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

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

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

Lyonizing Word: Formatting with Macros

Formatting with Macros

by Jack Lyon

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

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

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

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

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

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

Dim aStyle As Style

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

For Each aStyle In ActiveDocument.Styles

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

aStyle.Font.Name = "Adobe Garamond"

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

Next

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

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

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

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

Here's the line of interest:

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

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

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

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

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

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

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

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

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

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

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

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

________

How to Add Macro to Word & to the QAT

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

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

To actually use the macro:

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

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

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

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.

Lyonizing Word: Let’s Go Spelunking

 Let’s Go Spelunking

by Jack Lyon

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.

Lyonizing Word: Formatting with Macros

Formatting with Macros

by Jack Lyon

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

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

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

aStyle.Font.Name = "Adobe Garamond"

Next
End Sub

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

Dim aStyle As Style

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

For Each aStyle In ActiveDocument.Styles

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

aStyle.Font.Name = "Adobe Garamond"

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

Next

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

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

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

Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles

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

Next
End Sub

Here's the line of interest:

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

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

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

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

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

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

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

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

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

How to Add Macro to Word & to the QAT

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

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

To actually use the macro:

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

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

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

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

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.