Making a List of Words Italic

Written by Allen Wyatt (last updated December 23, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021


2

Trent works for a scientific publisher. In the manuscripts he works with there are many technical terms, such as names of various species of insects or animals. Scott has a need to make sure that all of these species names are italicized. Scott wonders if there is a way to use a list of terms (perhaps in a text file) and have Word make sure that each word in the list is shown in the document in italic.

There are multiple add-on tools you could get that would perform this particular task. Two of them suggested by WordTips readers include the following:

FRedit: http://www.archivepub.co.uk/book.html
EditTools: http://www.wordsnsync.com/

These are powerful tools, and you can even get FRedit for free. The downside, of course, is that each tool comes with its own learning curve that you'll need to go through in order to get it to do what you want.

Another approach is to create your own macro to perform the task. Fortunately, such a macro would not be that complex. Basically, you could create a plain text file (using a program such as Notepad) that would contain a single species name on each line. Your macro could then open the file, read each line, and change all instances of that species to italic in your document.

Sub FindSpeciesForItalic2()
    Dim sSpecies As String

    Open "C:\species.txt" For Input As #1
    Do While Not EOF(1)
        Line Input #1, sSpecies
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Replacement.Font.Italic = True
            .Text = sSpecies
            .Forward = True
            .Wrap = wdFindContinue
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Loop
    Close #1
End Sub

This macro relies on the text file named species.txt, stored in the root directory of the C: drive. (You can store it someplace else or name it something else, but in that case, you would need to change the line of code to reflect the changes.) After each line is read from the text file, Find and Replace is used to make sure that the text is changed to italic.

It typically wouldn't be a problem with species names, but you'll want to make sure that each line in the text file is unique enough that you don't get partial words affected in the document. For instance, it wouldn't be a good idea to do a search for just "one" because that would match things like "done" or "tone" or "loner" or... Well, you get the idea.

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 (13639) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and 2021.

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

Replacing a Colon in a Sequence

Sometimes you'll run across the need to replace a very specific sequence of characters in your document. It is for these ...

Discover More

Inserting Multiple Graphics in a Document

Word allows you to easily place graphics in a document. Placing one or two graphics is easy, but placing many graphics in ...

Discover More

Detecting an Open Dialog Box

Macros can be used to perform all sorts of tasks within Word. Some tasks can even occur at whatever time interval you ...

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 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!

More WordTips (ribbon)

Unable to Set Margins in a Document

If you find that you cannot set the margins in a document, chances are good that it is due to document corruption. Here's ...

Discover More

Turning Off Highlighter Display

You can use the highlighter tool to add all sorts of color to your document. If you want to turn off those colors so that ...

Discover More

Losing All Formatting in a Document

Have you ever made a formatting change to a couple of characters or to a paragraph, only to see those changes affect text ...

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 3 + 2?

2023-01-03 07:49:30

Pat

I needed to clear my find and replace dialog box before running this, so I added the following before the loop (i.e. before "Dim sSpecies As String")

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With


2022-12-23 05:45:27

Kiwerry

Thanks, Allen.
As far as the last paragraph in the tip is concerned, would the addition of the line

.MatchWholeWord = True

in the With ... With end construction not avoid the problem of getting partial words affected in the document?


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.

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.