Word: Macro to change headings to sentence case

July 1, 2011


You have a long Word document where one or more authors have used various cases for the headings — sentence case (first letter of the first word is capitalized), title case (first letter of all words or all main words are capitalized), and upper case (all words are capitalized). It’s a mess and you need to change all headings to be sentence case.


Run a macro to change the case based on a heading style.

For example, run the macro once to change the case of all Heading 1s, then change the heading style (Heading 1 below) in the macro code and run it again to change all Heading 2s; repeat for Heading 3s, Heading 4s, etc.

There’s probably a more elegant solution to find and change all heading styles at once, but as this is likely to be something you only use a few times, the extra effort to change the heading style’s name before each run is not arduous.

Macro to change headings to sentence case, based on the heading style

Sub ChangeCase()
    With Selection.Find
         .Wrap = wdFindContinue
         .Forward = True
         .Format = True
         .MatchWildcards = False
         .Text = ""
         .Style = ActiveDocument.Styles("Heading 1")
         While .Found
             Selection.Range.Case = wdTitleSentence
             Selection.Collapse Direction:=wdCollapseEnd
     End With
End Sub

Other options

Sentence case is defined in the macro by wdTitleSentence, but what if you want something different? Substitute wdTitleSentence with one of these options:

  • wdLowerCase — all lower case (probably not what you want as you’ll need an initial capital for a heading)
  • wdTitleWord — every word in the heading has initial capitals (including all the little words like ‘is’, ‘the’, ‘a’, ‘an’, ‘by’, ‘for’, etc.)
  • wdUpperCase — all upper case

There are other options too, but these are the main ones you’re likely to use.

If a macro is too scary for you, you can quickly change one heading at a time by selecting it, then pressing Shift+F3 one or more times in succession to toggle through the various cases.

[Links last checked June 2011; this macro is a modification of one from Allen Wyatt’s Word VBA Guidebook (http://store.tips.net/T010353_Word_VBA_Guidebook_Table_of_Contents.html)]


  1. Re.:”If a macro is too scary for you, you can quickly change one heading at a time by selecting it, then pressing F3 one or more times in succession to toggle through the various cases.”

    Don’t you mean Shift + F3?

  2. Excellent catch — yes, I did mean Shift+F3. I’ll change it in the text now.

    Thanks for letting me know!


  3. Thanks so much for this article. saved me hours!!. Modified it to change heading automaticaly to fix some formatting issues. you are awsome.

  4. Can this work with non-heading styles such as “Title”?

  5. Hi Anita

    There’s no reason it shouldn’t work — just change the style name in the macro above from “Heading 1” to “Title”.


  6. I have a bunch of headings that contain acronyms. Is there a way to make this macro skip the acronyms and leave them upper case?

  7. I have a problem, help me please!

    I’m hoping for a macro code that will work on WORD 2010. I have text like:

    “jamie thompson” is her aunt, “jamie thompson” didn’t want to leave.

    I’d like to make the capitalize each word:

    “Jamie Thompson” is her aunt, “Jamie Thompson” didn’t want to leave.

    I would be grateful if you could help me :)

  8. Hi Marsu

    Unless you have a LOT of these, a macro isn’t worth setting up. A simpler way to quickly change case is to select the two words, then press Shift+F3. That toggles the case. You can then select the next two words and either press Shift+F3 again, or, if that was the last action you did, press F4 to repeat it.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: