An American Editor

October 15, 2014

The Business of Editing: Workflow

Thirty years ago, when I first started my freelance editing career, most editing work was done on paper; the personal computer was just arriving and many in-house production staff avoided them as much as possible. But it was clear to me that online editing was going to be the standard and would change the editing world I started in.

The problem with paper-based editing is that it is not really possible to make it more efficient and thus raise an editor’s earning power. No matter what task you perform, it takes time and reorganizing workflow has limited benefit. Consequently, when I started I did little workflow analysis.

Computers changed everything. Computers changed client expectations and editor responsibilities. They could be instruments of efficiency or, as they were for many longtime editors, an albatross that could not be shaken. I still remember the arguments on various early lists, including the EFA list, about paper-based vs. computer-based editing, with many established editors viewing computers as a waste of money.

I embraced computer-based editing immediately. At that time, I saw it as an opportunity to set myself apart from other editors. I wasn’t thinking in terms of workflow and efficiency — but it wasn’t all that long before I was.

Every business has a workflow. Workflow is the process you follow from the time, in the case of editors, a project is committed to you to the time it is completed and final invoice is sent. Workflow, in and of itself, is neither efficient nor inefficient — it is just the orderly (or, perhaps for some, disorderly) manner in which work flows in the front door and out the back door. Yet how it flows can mean the difference between efficiency and inefficiency (Does it flow in the front door and make a bee line for the back door or does it zigzag its way eventually arriving at the back door?).

A common mistake many entrepreneurs make is not to think about workflow, not to map it out, and not to attempt to straighten the run from door to door. We forget that every deviance costs money and reduces profitability, as well as increases time required to come and go. Consequently,

Map Your Workflow

We all face competition for work. Few of us get to dictate pricing; instead either market competition or clients dictate pricing and we grumble about how underpaid we are. Some of us have improved our efficiency so that we can make lower (not low, but lower) pricing profitable and sufficient to generate our required or desired effective hourly rate (EHR). (For the discussion of effective hourly rate, see Business of Editing: What to Charge (Part I) and subsequent parts; also search An American Editor for effective hourly rate for additional essays.) Yet if we have not mapped our workflow and analyzed it for steps that can be modified, including eliminated or consolidated, then we haven’t gone far enough in our effort to be efficient and increase our profitability and EHR.

Mapping of workflow means creating what amounts to a timeline of your editing process. Each thing that you do should be identified as a step that takes you from the front door to the back door. It includes things like logging in the new project, creating a stylesheet for the project, dividing a manuscript that is sent as a single file into chapters, separating reference lists from the chapter, and so forth, down to the last steps of returning the edited manuscript to the client along with a final invoice.

In that workflow timeline, be sure to include the various steps you take while actually editing the manuscript. For example, if you use EditTools and create a Never Spell Word (NSW) dataset for each project, include that in the list. If you run macros, such as Editor’s Toolkit, to clean up manuscripts, include that step. If you run PerfectIt after editing is complete, include that step. If you run a macro you created called Zazzle, include that step. If you run Spell Check before you begin editing and again after you finish editing, include both steps.

The point is that you need to include every identifiable step you can in the workflow timeline so that you can evaluate how efficient or inefficient each step is and whether there is a better way to do it. BUT…

Also with each step you need to identify whether the step is performed preediting, during editing, or post editing; include a written explanation of the purpose of the step; what is actually accomplished by that step; what you really want that step to accomplish; and how long that step takes. For example:

Step 5 – Preedit: Create NSW dataset. Purpose is to create a dataset that includes client preferences; ensures client spelling preferences are uniformly applied across entire manuscript and that terms of art are preidentified as correct to avoid applying Spell Check incorrectly; I want to avoid spending time checking terms that Spell Check flags that are correct; creation of dataset takes 20 minutes

Why?

With that information in your workflow timeline, you can evaluate the step either based on past experience or after you complete your next project. Is this step worth the time and effort? If yes, then keep doing it; if not, then think about how to fix it or consolidate it with another step. You can also evaluate whether the step has implications for other projects.

By that I mean, using NSW as the example, if the project I am working on is for AAE Publishing and I know, hope, or expect that I will receive future projects from AAE Publishing on the same subject matter, can I take the time to create the dataset for this project and then use this dataset for future AAE Publishing projects? If yes, then the step may be efficient for this project because for future projects I will be able to skip this step and save 20 minutes.

The point is that you cannot look at steps in isolation, you must look at both today and tomorrow. Your workflow has to be efficient today and tomorrow.

The workflow timeline can help you rearrange the order in which you take steps. Reordering can increase or decrease efficiency, but you won’t know which it will do absent trying.

Just as knowing your required EHR is important to being successful as a business, so is the workflow. The more efficient your workflow, the more easily you will reach, even surpass, your required EHR.

Richard Adin, An American Editor

August 18, 2014

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.

June 9, 2014

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.

May 7, 2014

The Business of Editing: Backing Up Is Easy to Do

The title of this article put me in mind of a Neil Sedaka concert I attended more than 50 years ago. So before getting into backups, I thought we would take a trip down my memory lane. The two videos are of the same song, but performed at different tempos. The song was a big hit in both tempos, but 50 years ago, it was the faster version that made number 1 on the charts. Here is Neil Sedaka and his song, “Breaking Up is Hard to Do”:

The faster, peppier version

The slower, more “soulful” version

Now onward…

My computers are my livelihood. But as we know, computers go bad, they get stolen, viruses infect them — in other words, disaster preparedness needs to be in my vocabulary.

In prior articles (see, e.g., Business of Editing: Preparing for Disaster), I talked about how I have gone from fixed internal hard drives to removable internal hard drives as one method of protecting myself. And removable hard drives are really a boon. If you recall, I also wrote about twice getting hit with a ransomware virus that stopped me cold until it was removed at some expense (see Business of Editing: URLs, Authors, & Viruses).

Even then, my data was well protected, but I wasn’t able to return to work within seconds, which is my goal. I had to wait until the ransomware was removed because the ransomware didn’t let me access my computer so that I could access backups.

Last week I took the next step in my quest for protection. I upgraded my computer. My computer has been so stress-free and satisfactory, that the last major overhaul was about 5 years ago. Previously, I replaced my computers every 18 to 24 months.

This overhaul was essentially building a new computer. I replaced the RAM (and doubled it to 16 GB), the motherboard, the processor (went from a dual core to a quad core), a couple of hard drives (replaced older drives with two 2 TB hard drives and added a third solid state drive [SSD]), and the video card. Basically, I kept the case (I’ll never give up my Antec case), my three monitors, and my two SSDs.

In terms of performance, the new computer is like lightning compared to the previous version. My Journals macro currently has a dataset of more than 27,500 entries (and is constantly growing); it is my benchmark for speed. On the prior system took approximately 20 to 25 minutes to run through 800+ references; on the new system, it took 10 minutes to run through 883.

I’m drifting; back to backups.

One of the reasons for the upgrade was that I wanted to modify how I was doing backups. Previously, I relied largely on Carbonite for offsite backup and Backup4All for onsite. This worked well when combined with the removable drives — until the ransomware struck. That demonstrated to me a weak link in my system.

With the upgrade, I have added a 2-TB drive just for imaging backups, a second 2-TB drive for the Backup4All backups, and a third SSD that is a clone boot drive.

For the imaging, I purchased Acronis 2014 software (3-license version). I have set it to do a full image of my boot and data drives every 3 days; between those times it is set to do incremental backups. The Backup4All does daily backups of my full data drives and of select files on the boot drive. Carbonite backs up files that change from both the boot and data drives.

But the key to my new procedure is the third SSD drive. That drive, like all of the other drives, is removable and “hot swappable.” More importantly, that drive is a clone of my boot drive.

When malware strikes, it generally seeks to infect the boot drive. After all, if it only infects a data file, the cure is easy and the malware is just an annoyance, not a major problem. But if it infects the boot drive, it becomes a major problem and headache. The ransomware is such a problem because it prevents you from accessing your boot drive to get at it.

With my clone boot drive, should I be infected, I simply pop out the infected boot drive and insert the clone boot drive. I now have a running computer as if never struck by the malware. Granted, I will need to do some updating of a few of the files on the boot and data drives, but that takes a few minutes and is easy to do from Carbonite, Backup4All, or the Acronis image. I can then put the infected drive in another slot and reformat it. Once the drive is reformatted, I can use the Acronis software to clone the boot drive to the reformatted drive and I’m set should malware strike again (or even the boot drive fail).

Of course, I want the clone drive to be as current as possible, so I use Acronis to update the clone drive daily. I usually do it first thing in the morning after bootup, when I am confident that I do not have an infection on my system.

Each of the programs I use for backing up include a scheduler. When first installed, it took a few minutes to set the scheduler for each program, but once that was done, the backups take place when scheduled and in the background. How much easier can it be?

The keys to successful backups are (1) establishing a backup schedule and adhering to it, (2) using established software that is popular and well supported (and something more than barebones like what comes with Windows), and (3) using removable drives.

The removable drives are important because I can physically separate the drives from the computer. Thus, if someone steals my computer, all they are getting is the shell: The important material, the data, is elsewhere.

The removable drives are also important for malware protection, because they let you have a clone boot drive. Even if I cannot or do not want to deal with an infected drive myself, having the removable drives lets me remove the infected drive, replace it with a clone so I can go back to work, and give the infected drive to my computer tech for him to deal with. My downtime is the time it takes to swap the drives and update the few files that need updating, 30 minutes at most.

In talking with colleagues, I find that few are prepared for disaster. Perhaps now is the time to rethink our disaster preparedness and figure out what we can do should disaster strike.

Richard Adin, An American Editor

May 5, 2014

Lyonizing Word: Removing Spaces at the End of Table Cells

Removing Spaces at the End of Table Cells

by Jack Lyon

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 ‘That is, a specific area of the document
Dim aLen As Integer ‘That is, a number
Dim LastChar As String ‘That is, 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.

March 31, 2014

Lyonizing Word: Deleting Extraneous Carriage Returns in Footnotes and Endnotes

Deleting Extraneous Carriage Returns
in Footnotes and Endnotes

by Jack Lyon

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

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

You can try to remove the extraneous returns like this:

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

Your cursor should now be in the Notes pane.

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

^p^p

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

^p

 6. Click the “Replace All” button.

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

“This is not a valid action for footnotes.”

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

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

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

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

‘To clean returns in endnotes rather than footnotes, change “.Footnotes” to “.Endnotes” in the following line:

And now, here’s the macro:

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

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

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

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

Wend
GoTo TheEnd
TrapTheError:

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

TheEnd:
End Sub

Let’s look at some of those lines.

NoteCount = ActiveDocument.Footnotes.Count

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

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

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

The following lines, from

With Selection.Find

down to

Selection.Find.Execute

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

 .Replacement.Text = “”

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

 Selection.MoveRight
Selection.Delete

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

On Error GoTo TrapTheError

—which sends the macro to this line:

TrapTheError:

Here’s what happens next:

ErrorCount = ErrorCount + 1

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

Selection.MoveRight
Selection.Delete

We move right and delete the next return.

 If ErrorCount < NoteCount Then Resume Next

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

Selection.Find.Execute

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

While Selection.Find.Found

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

Wend

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

GoTo TheEnd

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

TheEnd:

marks the end of the whole operation.

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

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

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

March 3, 2014

Lyonizing Word: The Next Character Macro

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

______________

Lyonizing Word: The Next Character Macro

by Jack Lyon

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

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

The NextCharacter Macro

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

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

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

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

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

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

Sub NextCharacter()

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

Dim NextChar As String

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

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

NextChar = Str(AscW(Selection))

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

Str(AscW(Selection))

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

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

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

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

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

End Sub

This line simply ends the macro, or subroutine.

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

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

To actually use the macro:

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

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

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

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

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

November 22, 2013

Articles Worth Reading: More on Ransomware

Recently, I wrote about being attacked by ransomware (see Business of Editing: URLs, Authors, & Viruses). It appears that the problem is getting worse. I thought you would be interested in this short Ars Technica article (and the comments that follow it):

Soaring price of Bitcoin prompts CryptoLocker ransomware price break.”

The ransomware mentioned in the article is even more frightening (to me) than the ransomware I “caught,” and makes clear that it is more important than ever to regularly backup and image my hard drives.

Although the article is short, it is worth spending a few minutes to read. There are a lot of comments, but the first few are enough to emphasize the danger of ransomware and the need to be increasingly vigilant.

November 13, 2013

Business of Editing: URLs, Authors, & Viruses

Filed under: Computers and Software — americaneditor @ 4:00 am
Tags: , , ,

One of the things I most dislike about editing is the need to check author references. Aside from the mishmash manner in which the references are provided (e.g., it is not unusual to find two journal cites, one following the other, in completely different formats), I find that I am becoming increasingly angry at having to check URLs.

The Internet Age has brought many positive things to our world, but one negative is that authors increasingly cite URLs as a reference. Aside from the transience of URLs, they present a hazard to the editor who has to verify them.

Checking URLs has become expensive for me. Why? Because the links provided have become dangerous.

Twice in the last 3 months, I have inadvertently (i.e., unknown to me) downloaded ransomware (malware) to my computer as a result of clicking an author’s reference URL cite. Each of those incidents cost me several hundred dollars to remedy. In addition, my antivirus/antimalware software has protected me against another half dozen potential threats.

I’m not so angry about the threats against which I was protected by my antivirus software as I am about the ransomware ones that cost me money to cure. Fortunately, I have a local computer expert (the person who built and maintains my computers) who is willing to put me at the top of the list when I have a problem. Of course, it also means I pay for the service — and clients are unwilling to reimburse that expense.

What happened is that I clicked on a URL, found it was not good, and then moments later found that I could not access my computer’s primary screen — instead, I was faced with a demand for $300 to unlock my computer. Apparently, this is a regular scam. Sometimes the demand is labeled as coming from the FBI, sometimes it is from Homeland Security. According to my computer expert, if you pay the $300, you get a code to “unlock” the screen but then, sometime down the road, it locks up again and another demand for payment is made.

At least this bit of malware is less vicious than it could be. It only blocks access to the screen; it doesn’t attack data files.

I would be less angry about this if I thought the authors even cared a little bit, but considering that 75% of the URLs cited in the reference list in the latest project were either invalid (the URLs returned “Error 404: File Not Found” errors) or took me to clearly irrelevant sites, I have little faith in the idea that the author cares that at least one of the listed cites caused major problems for me — and would do the same for the reader who decided to check the cite.

We all know that the Internet can be a dangerous place. For the young, it is a source of never-ending bullying; for the elderly, it is a way to lose life savings; and for editors who have to check the validity of a cited URL, it is a way to infect one’s computer and suffer financial loss.

I am also mad at myself for getting caught by this malware twice. I am very careful about how I use the Internet and I make sure that I use up-to-date protection software. I even use the “pro” versions so that I get hourly updates. I also avoid likely troublesome sites. And for years I never suffered an invasion of malware.

Getting caught twice in 3 months is making me wonder what else I can do. It is hard to avoid the risk exposure when I have to check URLs as part of my job. And there is no way to know (at least not that I am aware of) in advance that a particular URL is going to make me wish I was retiring.

One colleague suggested that I simply not check URLs. Unfortunately, I cannot see an ethical way to do that. Instead, I am thinking of adding a clause to my “contract” that basically says, “client warrants that all URLs cited in the manuscript are virus- and malware-free. In the event that verifying a cited URL causes a virus or malware attack on my computer and/or network, client agrees to pay the cost of expert removal plus for my lost work time.”

I suspect that few clients would be willing to accept such a clause, especially if the client is a publisher or service provider rather than the author. But I need to do something, and the additional clause seems the best option at the moment. It would at least make my client aware of the potential for the problem.

For those of you who are interested in seeing what this particular virus is about, here is a link to Yoo Security. Should you get the virus, getting rid of it is a problem because you can’t easily access your desktop and rebooting doesn’t get around the problem. I suggest that you go now to your antivirus software’s website and search for ransomware under Support. There should be an article that tells you the steps you need to take to rid your computer of this malware. Print it and save it. Even if you can’t do it yourself, it may save you some money when you have someone else do the fix.

Have you experienced virus or malware attacks from client files? How did you deal with it?

October 28, 2013

EditTools 5.1 with Code Inserter Released

A new version of EditTools has been released. It is available at wordsnSync and is a free upgrade to current registered users of EditTools.

In addition to some minor bug fixes, version 5.1 includes a powerful, new macro, Code Inserter — an easy way to insert codes into a manuscript — and Assign Hotkeys — a new function that provides an easy way to assign hotkey combinations to EditTools macros.

Code Inserter

The idea behind Code Inserter is to make inserting codes, such as <ca>…</ca>, quick and easy. Code Inserter is a new top-level menu item. The process begins with the Insert Code Manager, which is shown here:

Code Inserter 3

As you can see from the image, there is a lot going on in the Manager. The Manager has the usual Open and New options. You can create a generic coding system for a client or one tailored to a specific project. You can also copy codes from one file to another using the Move/Copy Codes button.

If it is a new file, the Manager will be empty. You enter a name for the code in the Name: field (Chapter Author in the example) and the code that is to appear in the manuscript in the Code: field (<ca> in the example). You then indicate where the code is to be inserted: At the start of the line (At Start), at the location of the cursor (At Cursor), or at the end of the line (At End). You also indicate whether, after inserting the code, your cursor should move to the next line automatically. Finally, you indicate whether an end code is needed.

If you look in the main data field (where all of the codes in the dataset are listed), you will see that Chapter Author is highlighted. By looking across, you can see the name you gave the code, the code that will be entered, and which options you chose for that code (the Xs).

Note the Setup Hotkey button. Hotkeys are a new feature for several of the EditTools macros. This allows you to assign a key combination to run the macro. As shown in the image below, you can assign any keyboard combination to be the hotkey for this macro. (The hotkey runs the Code Inserter macro; it does not open the Manager.)

Code Inserter 4

When you run the Code Inserter macro, it brings up the box shown below, listing all of the codes you have created alphabetically by the name you assigned to the code.

Code Inserter 5

Just click on a code’s name or the checkbox next to the name, and the code will be automatically inserted according to the instructions you gave.

Code Inserter 6

If you also need an end code and checked that option for this particular code in the Manager, this dialog box will appear:

Code Inserter 7

Clicking OK will cause the end code to be inserted where you indicated and your cursor will return to where the beginning code was placed.

Code Inserter 8

As currently setup, to run Code Inserter you either need to click on Code Inserter in the main menu, then Run Code Inserter in the drop down menu, and finally on the code to be inserted. Alternatively, if you assigned a hotkey to the macro, you can press that key combination and then click on the code to be inserted.

However, there is a third option: You can assign to the main menu bar a Run CI button. The Code Inserter menu has an option called Activate “Run CI” Button. If you click this option, a button called Run CI appears in the main menu bar as shown below. Instead of using a hotkey to activate the macro, you can use this button. (The Deactivate “Run CI” Button deactivates this button and removes it from the menu bar.)

Code Inserter 9

Hotkeys

New in version 5.1 is an easy method for assigning certain macros to hotkeys. Not all of the macros are assignable; only those macros that are likely to be used more than once while editing a document. For example, it is expected that the Never Spell Word macro will be run just once on a document, whereas the Enhanced Search, Count, & Replace macro might be run multiple times.

In the case of Toggle, you run its Manager, and for Insert Query, you run the macro to access the Setup HotKey button. The Toggle Manager is shown below:

hot key 1

For those macros that can have hotkeys assigned to them but that do not have Managers, you access the Setup by going to Preferences > Hotkeys > Setup Hotkey for Macro, as shown in the image below. This opens a dialog from which you can choose which macro(s) you want to assign to a hotkey.

hot key 4

The other macros for which hotkeys currently can be set are Enhanced Search, Count, & Replace and Smart Highlighter. Select the macro to which you want to assign a hotkey, and then click the Setup Hotkey button. When done click Close.

hot key 3

These enhancements to EditTools have been under beta testing for a while and the reports are that Code Inserter has made coding quicker, easier, and typing-error free.

Information about these and the other macros included in EditTools is available at wordsnSync. If you haven’t tried EditTools, you should. To download the latest version of EditTools, go to the Downloads page and click on “Download EditTools v5.1″.

If you are interested in the ultimate deal, take a look at “A Special Deal: Editor’s Toolkit Ultimate!” This package includes the latest versions of EditTools, Editor’s Toolkit Plus, and PerfectIt at a significant discount.

Next Page »

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 1,310 other followers

%d bloggers like this: