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/

This entry was posted in Editing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@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 (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

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

    If you’d like to subscribe, please enter your name and email address below. We publish the newsletter once a week, and on rare occasions we may send an important announcement. We never, ever send spam. Thank you for signing up!