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

Superscript and Subscript at the Same Place

Do you want a superscript and subscript character to appear directly above each other without using the Equation Editor? ...

Discover More

Using Header Information as the Filename

Save a document for the first time, and Word helpfully suggests a filename you can use or change. If you want this suggested ...

Discover More

Connecting to an External Screen

Got a second monitor or projector you want to use with your Windows system? Here's how easy it is to take advantage of that ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Changing What Is Pasted in a Dialog Box

When you record a macro, Word very literally records what you do. This includes filling in various settings in dialog boxes. ...

Discover More

Understanding the While...Wend Structure

One of the basic programming structures used in VBA is the While ... Wend structure. This structure helps to make the ...

Discover More

Changing the Default Drive

Macros can be used to read and write all sorts of files. If those files are on a different drive than the current one, you'll ...

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 two more than 4?

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.