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)

2

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.

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

Controlling Automatic Indenting

Type a tab character and you might just find that Word adjusts the indentation of the entire paragraph. If you don't like ...

Discover More

Adding Multiple Rows to a Table

Need to add more than a single row to an existing table? Word provides an assortment of ways that you can accomplish the ...

Discover More

Forcing Word to Display Spelling and Grammar Errors

If your document has enough spelling errors in it, Word informs you that you have too many and then refuses to display the ...

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 (ribbon)

Inserting Text with a Macro

Need to have your macro insert a bit of text into your document? It's easy to do using the TypeText method.

Discover More

Getting User Input in a Dialog Box

Want to grab some interactive input from a user in your macro? The best way to do that is with the InputBox function, ...

Discover More

Controlling Repagination in Macros

Want to turn off document repagination while your macro does its work? Here are two approaches you can use.

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 8Mpixels. 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 0 + 7?

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.