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

Backing Up Your Custom Dictionaries

When you work with the spelling checker quite a bit, you eventually end up with a sizeable custom dictionary. You might ...

Discover More

Engineering Calculations

Need to normalize your data in some way so that all your values are in a given format? This tip presents a number of ...

Discover More

Merging and Printing a Series of Documents

Do you need to merge and print a number of documents in a particular order? Perhaps the best approach is to record a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Understanding Precedence

Formulas created in a macro have a specific order in which operations are performed. This is known as precedence, as ...

Discover More

Automatically Inserting Brackets

Want a fast way to add brackets around a selected word? You can use this simple macro to add both brackets in a single step.

Discover More

Jumping to the Start or End of a Document

When creating macros, it is often necessary to move the insertion point around the document so that text can be processed ...

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 eight minus 5?

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.