Is anyone else as frustrated as I am with Word's so-called Title Case (called "Capitalize Each Word" in Word 2007)?  I haven't actually found any use for that option; in general, only the more important words of a title should begin with uppercase letters.

But ta-da!  The Internet comes to the rescue, again.  Allen Wyatt's WordTips has a macro that will do what is needed.  Here it is, modified slightly—I added "an" and "and" to the list of words that should not be capitalized, and removed "is"; I was taught that all verbs, even small ones, are important enough to be capitalized.  It's easy to change the list to suit your needs, and I may modify it further through time.  If the excluded words occur at the beginning of the title, they are left in uppercase.

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

    ' list of lowercase words, surrounded by spaces
    lclist = " a an as and at but by for from in into nor of or the this to with "

    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

I'm no Word macro expert, but found this easy to install in Word 2007.   On the View tab, click the arrow under Macros.  Choose View Macros, then change the macro name to "TitleCase" (without the quotes) and click Create.  Visual Basic opens up with your macros, including one at the end for TitleCase.  Replace the rather empty text there—from "Sub Titlecase ()" through "End Sub"—with the macro above.  I added a button for the TitleCase macro to my Quick Access Toolbar, and now it's ready whenever I want it.

Posted by sursumcorda on Monday, April 13, 2009 at 8:17 pm | Edit
Permalink | Read 6657 times
Category Computing: [first] [previous] [next] [newest]
Comments

According to the grammar book we used this year:
"Capitalize the first word, the last word, and all important words of any title. Do not capitalize a, an, the, and, but, or, nor, or prepositions of four or less letters unless they are the first or last letters of a title. Capitalize all other words.
Capitalize any verb in a title." (They provide an example showing that "is" should be capitalized.



Posted by dstb on Tuesday, April 14, 2009 at 8:27 am

Thanks! As you can see, I've incorporated most of your suggestions. Some decisions must be made in context, I think, so I don't want to make the list too comprehensive. But if anyone sees an obvious word I've left out, please say so.

Um...since this is grammar book speaking...shouldn't it be "prepositions of four or fewer letters"? ;)



Posted by SursumCorda on Tuesday, April 14, 2009 at 9:20 am

I did double check to make sure I hadn't written it wrong and it does say "four or less". I agree, four or fewer sounds better.



Posted by dstb on Tuesday, April 14, 2009 at 4:11 pm