Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Intelligent Title Case.

Intelligent Title Case

by Allen Wyatt
(last updated February 22, 2020)


Word contains a couple of different ways that you can adjust the case of selected text. One way is to click Format | Change Case to display the Change Case dialog box. Word lists different ways in which it can adjust the case of your text. One of the most common case changes is title case. This type of change results in each word of the selected text being uppercase, while the rest of the letters are in lowercase. The only problem with this is that Word is rather indiscriminate in what it capitalizes. For instance, if you select the text "this is a test" and then use the Change Case dialog box to change the text to title case, you end up with "This Is A Test." Common rules of capitalization, however, would dictate that the "short" words ("is" and "a") should not be capitalized.

This is where a macro comes in handy. You can create a macro to intelligently apply title case to a text selection. The macro can be programmed so that it ignores a specific set of words while doing its work. Consider the following macro:

Sub TitleCase()
    Dim lclist As String
    Dim wrd As Integer
    Dim sTest As String

    ' list of lowercase words, surrounded by spaces
    lclist = " of the by to this is from a "

    Selection.Range.Case = wdTitleWord

    For wrd = 2 To Selection.Range.Words.Count
        sTest = Trim(Selection.Range.Words(wrd))
        sTest = " " & LCase(sTest) & " "
        If InStr(lclist, sTest) Then
            Selection.Range.Words(wrd).Case = wdLowerCase
        End If
    Next wrd
End Sub

When you select some text and run this macro, the first thing it does is to change the text to Word's standard title case. It then steps through the words in the selection (Word makes the words available in the Words collection), examining each one. Each word is extracted and placed in the sTest variable, which then is converted to lowercase. The content of sTest is then checked against the lclist string to see if there is a match. If there is, then the word in the original text is converted to lowercase.

The key to the macro is the lclist string. This string contains a list of words that you want to always appear in lowercase. These words are surrounded by spaces—including the first and last words of the string. When the sTest comparison is done, sTest contains a leading and trailing space so that successful matches can be made. (The spaces are included so that there are no mistakes in word matching, for instance matching "he" to a part of "the".)

Note, as well, that the comparison portion of the macro doesn't pay attention to the first word in the text selection. This word is assumed to be the first word of a phrase or sentence, which should always start with an uppercase character.


If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (215) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Intelligent Title Case.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Grouping Drawing Objects

Drawing objects are easily added to a document. You can group these objects so they are easier to manage by following the ...

Discover More

Small Red Dots under Addresses

Does your document have all sorts of different colored underlines on it? Tracking down what most of them are can be easy, ...

Discover More

Selecting Text in Linked Text Boxes

Text boxes are often used as design elements in a document layout. If you have linked text boxes, you may have noticed ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Adjusting Small Caps Text

If you use small caps text in a document, you know that there are several steps involved in properly formatting the text. ...

Discover More

Replacing Quoted Text with Italics

If you have text surrounded by quotes in a document, you may want to remove the quote marks and make the text that was ...

Discover More

Embossing Text

Word can make your text look as if it has been embossed on the page.

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 2?

2021-01-29 01:54:47

Lee Quinn

Thanks Ken, appreciate it! I'm still learning :)

2021-01-28 05:47:35

Ken Endacott


Your macro goes into an endless loop if Track Changes and Show Markup are on. This could be avoided by inserting after the Dim statements:

ActiveDocument.TrackRevisions = False
ActiveWindow.View.ShowRevisionsAndComments = False

Editor’s clients often specify that any changes be highlighted using Track Changes. Neither Allen’s or Lee’s macros will do that.

2021-01-27 20:13:34

Lee Quinn

for what it's worth, here's my take - thanks to Allen for the inspiration :)

Private Sub Tools_Set_Heading_Title_Case()
' affects ALL document content
' set expected 'proper' case for each heading
' find and set upper case where required
' find and set lower case where required
' reapply style to heading in case someone originally created the style as 'all caps'/'small caps'
' as we still want to see the 'proper' case in the navigation pane
Dim objStyle As Style
Dim arrTargetStyles(), arrTargetAllUpperCaseWords(), arrTargetAllLowerCaseWords()
Dim varCounter As Variant, arrUWord As Variant, arrLWord As Variant

arrTargetStyles = Array("Heading 1", "Heading 2", "Heading 3", "Heading 4")
arrTargetAllUpperCaseWords = Array("AS ", "CBTS", "CF", "CPU", "HMI", "HSTS", "LDS", "NTP", "PLC", "RCA", "RS LDS", "RS-LDS", "SD", "VSS", "WMS")
arrTargetAllLowerCaseWords = Array(" and ", " for ", " of ", " on ", " the ", " to ")

For Each varCounter In arrTargetStyles
With Selection.Find
.Wrap = wdFindContinue
.Forward = True
.Format = True
.MatchWildcards = False
.Text = ""
.Style = ActiveDocument.Styles(varCounter)

While .found
'Debug.Print "Configuring "; varCounter; " "; Selection.Text
' set title case
Selection.Range.Case = wdTitleWord
' find and fix upper case matching words
For Each arrUWord In arrTargetAllUpperCaseWords
If InStr(1, Selection.Text, arrUWord, vbTextCompare) > 0 Then
Selection.Text = Replace(Selection.Text, arrUWord, UCase(arrUWord), 1, 1, vbTextCompare)
End If
Next arrUWord
' find and fix lower case matching words
For Each arrLWord In arrTargetAllLowerCaseWords
If InStr(1, Selection.Text, arrLWord, vbTextCompare) > 0 Then
Selection.Text = Replace(Selection.Text, arrLWord, LCase(arrLWord), 1, 1, vbTextCompare)
End If
Next arrLWord
' reapply style to heading
Selection.Style = varCounter
Selection.Collapse Direction:=wdCollapseEnd
End With
Next varCounter

Set objStyle = Nothing
Set varCounter = Nothing
Erase arrTargetStyles
Erase arrTargetAllUpperCaseWords
Erase arrTargetAllLowerCaseWords

Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst

'Debug.Print "Finished!"
End Sub

2020-05-25 13:27:44

Jim Dandy

I'm trying to do this for PowerPoint but I can only find a way to apply title case to slide titles. I cannot seem to figure out the proper way to title-case selected text like that which exists in the text boxes and content sections.

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.


FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.