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.
by Allen Wyatt
(last updated June 25, 2018)
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.
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.
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!
Need to know how many paragraphs are in a document? You can use Word's Find and Replace feature to get a count quickly.Discover More
Word allows you to search not for special characters that normally do not print such as paragraph marks and line breaks.Discover More
Need to change the alignment of some tabs in a multitude of paragraphs? How you approach the problem depends on whether ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.