Title Case Macro, Version 2

Last week’s newsletter featured a macro to change all-cap headings into title case. It had some drawbacks, though. It would do only one heading level at a time, and you had to specify which heading level you wanted it to work on. In addition, it didn’t lowercase articles, prepositions, and conjunctions. What’s really needed is a macro that will cycle through *all* of your heading levels (any paragraph styled with one of Word’s Heading paragraph styles, such as Heading 1), make them title case, and lowercase articles, prepositions, and conjunctions unless they occur at the beginning or end of the heading. Oh, and one more thing: It should capitalize any word following a colon and a space. I’m giving away the store here, but here’s the macro, which I hope you’ll find useful:

Sub TitleCaseHeadings()
'Created by Jack M. Lyon
For h = 1 To 9
Selection.HomeKey Unit:=wdStory
myHeading$ = "Heading" + Str(h)
Selection.Find.Style = ActiveDocument.Styles(myHeading$)
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
While Selection.Find.Found = True
Selection.Range.Case = wdTitleWord
For Each wrd In Selection.Range.Words
Select Case Trim(wrd)
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
End Select
Next wrd
wrdCount = Selection.Range.Words.Count
Selection.Range.Words(1).Case = wdTitleWord
Selection.Range.Words(wrdCount - 1).Case = wdTitleWord
strLength = Selection.Range.Characters.Count
For i = 1 To strLength
If Selection.Range.Characters(i) = ":" Then
Selection.Range.Characters(i + 2).Case = wdTitleWord
End If
Next i
Next h
MsgBox "Finished!", , "Title Case Headings"
End Sub

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

If you’re wondering why you’d want to use a macro like that one, please see my article “The Case against Caps”:


Please note that you can modify the macro to specify the words you want to be lowercased. Here are the lines you’ll need to change:

Case “A”, “An”, “As”, “At”, “And”, “But”, _

“By”, “For”, “From”, “In”, “Into”, “Of”, _

“On”, “Or”, “Over”, “The”, “Through”, _

“To”, “Under”, “Unto”, “With”

For example, if you wanted to add “Throughout,” the modified lines might look like this:

Case “A”, “An”, “As”, “At”, “And”, “But”, _

“By”, “For”, “From”, “In”, “Into”, “Of”, _

“On”, “Or”, “Over”, “The”, “Through”, _

“To”, “Under”, “Unto”, “With”, “Throughout”

You can also delete words. For example, if you wanted to delete “As,” the modified lines would look like this:

Case “A”, “An”, “At”, “And”, “But”, _

“By”, “For”, “From”, “In”, “Into”, “Of”, _

“On”, “Or”, “Over”, “The”, “Through”, _

“To”, “Under”, “Unto”, “With”

Don’t worry about getting the lines too long. You won’t. The lowlines _ at the end of each line just break up the macro for easy reading. You can delete them and the following paragraph returns to merge the four lines if you want to.

By the way, you don’t have to reserve the macro for changing headings in all caps. You can use it on any headings that need to be changed to true title case. This does not, however, excuse you from editing your headings.

Thanks to Hilary Powers for suggesting the improvements.



Peg Wier wrote:

I agree with you on all counts about the formatting of headings with all caps. I think you left out the most important case against all caps–THEY ARE HARD TO READ!

Bruce White wrote about converting Word documents to HTML:

There are a whole bunch of tools that grew from WinHelp tools. Reworx grew out of HDK by Virtual Media. See the Republicorp website:

Instead of cleaning up Word HTML what you do is get the tool to generate the code from the Word document. It breaks the document into separate HTML pages based on the heading styles in the document. It will preserve the index entries, the links and especially the outline structure (levels of headings–which you can use it in a TOC if you want).

OR the pages can be passed to Dreamweaver and maintained there.

Many thanks for the help and suggestions.



Ever heard of a candrabindu? Want to know the difference between oblique and inclined? You can learn all kinds of interesting things from the Encyclopedia of Typography and Electronic Communication:


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:


    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.