in Editing

Fixing All Caps in Text

The newsletter a couple of weeks ago featured a macro that would set all headings in a Word document in true title case, with articles and prepositions lowercased. But what if you have a document in which an author has typed other stuff in all caps--author names in footnotes, or book titles in body text? It would be nice to have a macro that would look for anything in all caps and turn it to title case. I've modified the macro to do just that:

'THE MACRO STARTS HERE
Sub FixAllCapsInText()
'Macro created 10/19/2003 by Jack M. Lyon
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[A-Z]{2,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
While Selection.Find.Found = True
Selection.Range.Case = wdTitleWord
Select Case Selection.Range
Case "A", "An", "As", "At", "And", "But", _
"By", "For", "From", "In", "Into", "Of", _
"On", "Or", "Over", "The", "Through", _
"To", "Under", "Unto", "With"
wrd.Case = wdLowerCase
Case "Usa", "Nasa", "Usda", "Ibm", "Nato"
wrd.Case = wdUpperCase
End Select
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
MsgBox "Finished!", , "Fix All Caps in Text"
End Sub
'THE MACRO ENDS HERE

If you don't know how to use macros like that one, you can learn how here:

The key to the macro is this line:

.Text = "[A-Z]{2,}"

That tells Word to do a wildcard search for two or more capital letters in a row. If you like, you can make that number larger to avoid such common acronyms as USA and NASA. A better way to take care of such items, however, is to list them in the following line of the macro:

Case "Usa", "Nasa", "Usda", "Ibm", "Nato"

For more information, see the newsletter here:

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

And the Readers Write column in last week's newsletter here:

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

And if you'd like more information about wildcard searching, feel free to download my paper "Advanced Find and Replace in Microsoft Word":

http://www.editorium.com/ftp/advancedfind.zip

Thanks to Linda Northrup for suggesting this topic.

_________________________________________

READERS WRITE

Jim Pinkham pointed out that the modified macro in last week's Readers Write column had a mistake on one line:

wrd.Case = wdUpperCase End Select

That should actually be two lines, like this:

wrd.Case = wdUpperCase

End Select

If you had trouble running the macro, that's why.

Johanna Murphy wrote:

"The Title Case Headings Macro is awesome! Although I would need one where you only change one level at a time. Also, I have created other styles which are named OUT and OUTNUMBER (with only 5 levels) that we use a lot in our law firm. How can I change the macro to specify those style names?"

I responded:

To use different styles with the macro, do this:

1. Delete these two lines:

For h = 1 To 9

Next h

2. Modify this line--

myHeading$ = "Heading" + Str(h)

--to something like this:

myHeading$ = "MyStyle"

Last week William T. Buckley wrote, "This is not a huge issue, but it does come up once in a while, especially in limited-space conditions. How do I produce a circled-c 'circa' sign or symbol, not to be confused with a (c) copyright symbol?"

Clarke P Gerber responded, "I've checked several specialist texts (including Chicago Manual of Style; NY Times Manual of Style and Usage) and cannot find any authority for using a circled 'c' as an abbreviation for circa. My own regional bible--The Cambridge Australian English Style Guide--says the following: 'When spelled out in full circa is often italicised. When abbreviated as c. or ca. it is now usually set in roman.'"

Thanks to Jim, Johanna, and Clarke for their messages.

_________________________________________

RESOURCES

The Microsoft Office Assistance page has a wealth of resources for Word users, including tips, templates, demos, and quizzes:

http://office.microsoft.com/assistance/