Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Searching for Non-Black Text.

Searching for Non-Black Text

Written by Allen Wyatt (last updated May 25, 2019)
This tip applies to Word 97, 2000, 2002, and 2003


1

When searching for text in a document, it is easy to search for formats such as "bold" or "italic." You can also search for "not bold" and "not italic." You can search for text of a specific color, but Word does not allow you to search for text other than a specific color. For instance, you cannot search for text that is "not black."

If you need to search for text that is not black, then the best way to do so is with a macro. Consider the following macro, which prompts you for your search text, and then looks for the first non-black instance of that text.

Sub FindNotBlack()
    With Selection.Find
        .ClearFormatting
        .Text = InputBox(prompt:="Enter the search text.", _
          Title:="Find Nonblack Text")
        Do While .Execute
            With Selection.Font
                If (.Color <> wdColorAutomatic) And _
                  (.Color <> wdColorBlack) Then
                    MsgBox "Found"
                    Exit Sub
                End If
            End With
        Loop
    End With
End Sub

Note that the macro checks to see if the color of the matched text is different from black (wdColorBlack) and from the automatic color (wdColorAutomatic). This is because the automatic color is black on most systems.

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 (1387) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Searching for Non-Black Text.

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

Character Frequency Count

Word collects a wide range of statistics about your documents, but one of the things it doesn't collect is how many times ...

Discover More

Reducing File Sizes for Workbooks with PivotTables

Need to reduce the size of your workbooks that contain PivotTables? Here's something you can try to minimize the ...

Discover More

Problems Pasting Information into a Worksheet

What do you do if pasting information into a worksheet brings Excel to its knees? This tip looks at just a few ideas you ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (menu)

Searching for Special Hyphens

Word allows you to use a couple of different types of hyphens in your document, each with a different purpose. If you ...

Discover More

Searching for Special Characters

When using the Find and Replace feature of Word, you can search for more than plain text. You can also search for ...

Discover More

Special Characters in Pattern Matching

The most powerful search engine in Word use pattern matching, but the way you specify special characters in a ...

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

2021-03-17 02:17:13

JW

Thanks for this! It is very close to what I was seeking.

Is there a way to tweak it to find ANY text that is not black or "automatic"?

Thank you!


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.