Correcting Misspelled Words

March 24, 2006 – 12:00 pm

In our last episode, I provided a macro to make a list of misspelled words found in a document. You’ll find the macro here:

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

So you’ve got your list; now how do you use it?

The way *I* recently used it on a multivolume typesetting project was to automatically fix a bunch of archaic (along with just plain wrong) spellings. Here’s what I did:

1. Sorted the misspelled words alphabetically.

2. Removed duplicates.

3. Put each word beside itself, separated by a pipe symbol, so the lines looked like this:

fulfil|fulfil

fulness|fulness

kanyon|kanyon

4. Corrected the spelling of the words on the right side of the list:

fulfil|fulfill

fulness|fullness

kanyon|canyon

5. Used the list with my MegaReplacer program to automatically replace the misspelled words on the left with the correctly spelled words on the right–in all the chapters of all the volumes. Whew! More on MegaReplacer here:

http://www.editorium.com/14843.htm

Of course, it would have been nice to have a macro that did steps 1 through 3 for me (sort misspelled words, remove duplicates, put each word beside itself). So I made one. And I’ll share:

‘MACRO STARTS HERE

Sub MakeCorrectionList()

‘Define variables

Dim Para1$

Dim Para2$

Dim aPara

‘Sort words alphabetically

Selection.WholeStory

Selection.Sort

‘Delete duplicate words

Selection.WholeStory

For Each aPara In ActiveDocument.Paragraphs

Para2$ = aPara

If Para1$ = Para2$ Then

aPara.Range.Delete

Else

Para1$ = Para2$

End If

Next

‘Duplicate list side by side

‘with pipe symbol separating

Selection.WholeStory

Selection.ConvertToTable _

Separator:=wdSeparateByParagraphs

Selection.Copy

Selection.InsertColumnsRight

Selection.Paste

Selection.Tables(1).Select

Selection.Rows.ConvertToText _

Separator:=”|”, NestedTables:=True

‘Add code indicating Match

‘Case and Whole Word Only

Selection.HomeKey Unit:=wdStory

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting

With Selection.Find

.Text = “^p”

.Replacement.Text = “+&^p”

.Forward = True

.Wrap = wdFindContinue

.Format = False

.MatchCase = False

.MatchWholeWord = False

.MatchWildcards = False

.MatchSoundsLike = False

.MatchAllWordForms = False

End With

Selection.Find.Execute _

Replace:=wdReplaceAll

Selection.HomeKey Unit:=wdStory

End Sub

‘MACRO ENDS HERE

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

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

That last bit, “Add code indicating Match Case and Whole Word Only,” is for use by MegaReplacer, and it will add +& at the end of each entry. In addition, at the bottom of the list, you’ll get one final carriage return preceded by +&. You should delete that line before using the list with MegaReplacer.

You may find other uses for the macro as well–or at least pieces of it. For example, this part will delete duplicate paragraphs (i.e., single words on a line) in any list:

‘MACRO STARTS HERE

Sub DeleteDuplicates()

‘Delete duplicate words (i.e., paragraphs)

Dim Para1$

Dim Para2$

Dim aPara

For Each aPara In ActiveDocument.Paragraphs

Para2$ = aPara

If Para1$ = Para2$ Then

aPara.Range.Delete

Else

Para1$ = Para2$

End If

Next

End Sub

‘MACRO ENDS HERE

And the following part will create a two-column table with the list of words in each column. You can then use the table as the basis for an index concordance. More here:

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

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

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

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

‘MACRO STARTS HERE

‘Sub MakeConcordanceTable()

‘Duplicate list side by side in a table

Selection.WholeStory

Selection.ConvertToTable Separator:=wdSeparateByParagraphs

Selection.Copy

Selection.InsertColumnsRight

Selection.Paste

End Sub

‘MACRO ENDS HERE

_________________________________________

READERS WRITE

Niquette Kelcher wrote:

I have a wildcard question for you that I haven’t been able to figure out. I’d like to supply the answer to my students, who have been trying to figure it out with me.

If I have a manuscript with “Titles in Quotations Like This”, how do I italicize the title AND get rid of the quotation marks at the same time? My incorrect approach is as follows — it italicizes the text but doesn’t get rid of the quotation marks. I feel I’m missing something obvious!

Find: “*” (use wildcards)

Replace: ^& (Ctrl + I)

Your help would surely be appreciated!

I responded:

You’ll need to put the asterisk inside parentheses so it functions as a “group”:

Find: “(*)” (use wildcards)

Then use the “Find What Expression” code as the replacement for the text found by the group:

Replace: \1 (Ctrl + I)

More information here:

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

——————————–

Ed Millis wrote:

I write/edit technical report documents. I am not in charge of creating them; they are simply emailed to me or handed over on a CD, and I get to insert data and format to a fine finish. Either the document or the data can come in any format or mixture of styles, including web page and Excel file, and with or without automatic bullets, lists, and indents.

So the first thing I do is reformat everything to a Normal style, no automatic anything, and set my tabs. Then, as I go through the document, I apply formatting or style to create headings and table or figure labels.

The last thing I do with one of these reports (often up to 200 pages) is print out a low-resolution non-color copy so I can go over it with pen in hand to ensure all tables and figures are numbered correctly and correspond to their text mention, make sure every paragraph has the proper indent and reference (every (a) has a (b), and it’s not (b) when it should be (2), and I didn’t overlook any abbreviations.

Has anything crossed the desk of the Editorium that might make dealing with those last items a bit easier?

I responded:

No. But it’s an interesting question. I’ll look into it.

Not having been able to find an answer, I appeal to you, gentle reader. Do you have a solution for Ed?

Many thanks to Niquette and Ed.

_________________________________________

RESOURCES

Need an online style guide for easy reference? Try the Wikipedia Manual of Style:

http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style

Need something more thorough? Try the Guide to Grammar and Style, by Jack Lynch at Rutgers:

http://andromeda.rutgers.edu/~jlynch/Writing/

_____________________________________________________

THE FINE PRINT

Editorium Update (ISSN 1534-1283) is published by:

The EDITORIUM, LLC

Microsoft Word Add-Ins for Publishing Professionals

http://www.editorium.com

Copyright © 2008 by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

You may forward copies of Editorium Update to yourself and others (but not charge for it) and print or store it for your own use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is prohibited. Send reprint requests to reprints [at symbol] editorium.com

Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user assumes the entire risk as to the accuracy and use of this document.

The Editorium is not affiliated with Microsoft Corporation.

_____________________________________________________

HOW TO SUBSCRIBE OR UNSUBSCRIBE

To subscribe, send a blank email message to editorium-subscribe [at symbol] topica.com.

To unsubscribe, send a blank email message to editorium-unsubscribe [at symbol] topica.com.

We do not sell, rent, or give our subscriber list to anyone.

____________________________________________________

You must be logged in to post a comment.