Changing Character Color

Written by Allen Wyatt (last updated July 19, 2022)
This tip applies to Word 97, 2000, 2002, and 2003


1

Imagine that you are developing a document that uses text colors to signal special meanings to the reader. For instance, you may use red text to indicate what the user should type. If you are developing a document in which you use color within your text, it can be a real bother to use the menus over and over again to change text colors. In such an instance, it is helpful to have a macro that modifies the color automatically. You can assign the macro to a key combination or a toolbar button so you don't have to use the menus. The following macro changes the color of the currently selected text to red.

Sub MakeRed()
    If Selection.Type = wdSelectionNormal Or _
      Selection.Type = wdSelectionBlock Then
        Selection.Font.ColorIndex = wdRed
    Else
        Beep
    End If
End Sub

If you want to use a different color besides red, change the color assignment made in the macro. (Just change the constant wdRed to the desired color.) VBA allows you to use constants to represent colors. There are seventeen different color numbers available:

Number Text Color Word Constant
0 Auto wdAuto
1 Black wdBlack
2 Blue wdBlue
3 Cyan wdTurquoise
4 Green wdBrightGreen
5 Magenta wdPink
6 Red wdRed
7 Yellow wdYellow
8 White wdWhite
9 Dark Blue wdDarkBlue
10 Dark Cyan wdTeal
11 Dark Green wdGreen
12 Dark Magenta wdViolet
13 Dark Red wdDarkRed
14 Dark Yellow wdDarkYellow
15 Dark Gray wdGray50
16 Light Gray wdGray25

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 (253) applies to Microsoft Word 97, 2000, 2002, and 2003.

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

Fixing "Can't Find Files" Errors

If you get errors about unfindable files when you first start Excel, it can be frustrating. Here's how to track down and ...

Discover More

Generating a Web Page

Want your worksheets to be available to others on the Internet? Excel provides a way you can save your data in HTML ...

Discover More

Rounding Time

Need to round the time in a cell to a certain value? There are a couple of ways you can do this with a formula.

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

Adding a Little Color

The normal way to change the color of selected text is through the use of the Font Color tool. If you have to use the ...

Discover More

Engraving Text

Word allows you to format your text in a number of different ways. One rather esoteric way to format your text is by ...

Discover More

Making Text Bold

Want a cool shortcut to make your text bold? Here's a method that fits in wonderfully with how things are done in the ...

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}] (all 7 characters, in the sequence shown) 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 6 - 0?

2020-12-02 05:48:29

Giang Pham

How if I want the color out of these 17 colors, say, RGB(161,52,88)?


This Site

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

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