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

Repeating Table Rows with Manual Page Breaks

Need to make sure part of a table is on one page and part on another? The way to do so is not to use manual page breaks, for ...

Discover More

Opening an HTML Page in a Macro

Excel allows you to open HTML pages within the program, which is great for some purposes. What if you want to open a browser ...

Discover More

Condensing Multiple Worksheets Into One

Want a quick way to combine your worksheets? This tip features a simple macro to do the task for you.

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Determining the Number of Fonts Available

When creating a macro, you may need to figure out how many fonts are available to Word. You can do this using the FontNames ...

Discover More

Running Macros Based on Keywords

Wouldn't it be great if Word could execute a macro every time someone typed in a particular keyword or phrase? Word may not ...

Discover More

Displaying the User Name in the Status Bar or Title Bar

Sometimes it can come in handy to know who the current computer user is, as far as Word is concerned. This tip presents ways ...

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 9 - 2?

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.