Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Converting Text to Uppercase in a Macro.

Converting Text to Uppercase in a Macro

by Allen Wyatt
(last updated November 1, 2014)

3

There are two ways you can convert text to uppercase in Word, within a macro. The first is to use the AllCaps property and the second is to use the Case property. The following shows how to use both methods.

Selection.Font.AllCaps = True
Selection.Range.Case = wdUpperCase

Both of these statements assume you have selected the text to be changed prior to issuing the statements. The difference between them is that the AllCaps property controls only the formatting of the text—it only appears as uppercase. The Case property, on the other hand, actually changes the letters in the selection so they are uppercase.

Note:

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 (9354) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Converting Text to Uppercase in a Macro.

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. ...

MORE FROM ALLEN

Adding an Equal Sign Tool

Excel used to provide, prior to Excel 2002, an equal-sign tool near the Formula bar. If you miss this tool, you may want ...

Discover More

Displaying Quick Document Statistics

Need to see how many pages, words, paragraphs, or lines are in your document? Word makes it easy to retrieve such ...

Discover More

Locking All Non-Empty Cells

Need to make sure that your worksheet is locked, with only the blank cells accessible to editing? You can do this easily ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Copying a File in VBA

Need to have your macro copy a file from one place to another? It's easy to do using the FileCopy command, described in ...

Discover More

Determining the Number of Pages in Your Document

If your macro needs to know how many pages are in your document, you can use the Information method to get the desired ...

Discover More

Understanding the For ... Next Structure

Spend any time creating Word macros, and sooner or later you will need to repeat some of your programming code a certain ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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}] 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 three less than 4?

2018-07-18 23:06:52

Emily Maina

Just wanted to say thank you Daniel Hinostroza! I have been looking for a macro like this on and off for about 4 months and most of what I was finding was telling users to use the built-in Word autocorrect which wouldn't work in my case. Really saved the day and A LOT of manual work for me in the future! It works perfectly for me and I added a few lines in to get rid of extra spaces and empty paragraphs/lines. Thanks again!


2015-02-10 11:51:35

Daniel Hinostroza

I found another solution:
---------------------------------
Sub FirstLetterUppercase()
'
' FirstLetterUppercase Macro
' Word 2011 macro to change first letter in sentence to uppercase
' .End = .End + 1 will uppercase the first two letters.
' In its present state, it forces wdFindStop to loop to the next paragraph.
'
With ActiveDocument.Content.Find
.Text = "(^13)([a-z])"
.Replacement.Text = "^p2"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False

Do While .Execute = True
With .Parent
'Include the next character
.End = .End
'Change to uppercase
.Case = wdUpperCase
'Make sure to move on to next paragraph
.Start = .End
End With
Loop
End With

End Sub


2015-02-10 10:48:44

Daniel Hinostroza

Hi,
this is my macro in Word 2011 (Mac):

Sub FirstLetterUppercase()
'
' FirstLetterUppercase Macro
' Word 2011 macro to change 1st letter in sentence to Uppercase
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(^13)([a-z])"
.Replacement.Text = "^p2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub


Your solution seems to be a simple line to add to the macro but I don't know how. Where would you place "Selection.Range.Case = wdUpperCase" to change the fist letter to uppercase on my macro?
Thanks very much beforehand.
All the very best,
Daniel


This Site

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

Newest Tips
Subscribe

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.