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: Auto Creation of an Acronym List.

Auto Creation of an Acronym List

by Allen Wyatt
(last updated June 17, 2014)

9

Karl works in an occupation that uses a lot of acronyms. Their standard procedure is to define the acronym only the first time it's used within the document. In addition, they always need to create an appendix, at the end of the document, listing the acronyms in alphabetical order along with their meanings. Karl is looking for a way to perhaps "mark" the acronym in the main body and have the acronym appendix be automatically created.

There is no way to do this directly in Word. There are several types of tables you can create automatically, such as tables of contents, tables of authorities, and indexes. These last two tables (tables of authorities and indexes) could possibly be used to create the acronym list, but only if they are not already being added to your document and only if you don't mind your acronym list including page numbers.

If you want to use the table of authorities tool in order to create an acronym list, Shauna Kelly has put together a great article on how this can be done. The article specifically talks about glossaries, which essentially what an acronym list would be.

http://www.ShaunaKelly.com/word/glossary/glossary.html

If you want to use the index tool in order to create your list, you can follow these general steps, assuming that the acronym, when defined, is followed by its meaning within parentheses:

  1. Select the acronym and its meaning. This means that you find the first instance of the acronym in your document and then select that acronym along with the parenthetical meaning that follows it.
  2. Press Alt+Shift+X to mark the selected text for the index.
  3. Repeat steps 1 and 2 for the other acronyms you want in your list.
  4. At the end of your document, insert your index. How to actually insert an index has been covered in other issues of WordTips.

You'll note that this approach leaves the parentheses in your index. If you don't want the parentheses, then you'll need to go to each acronym that you marked and display the field code used for the index. It will look something like this:

{ XE "abbrev (this is the definition)" }

Within the field code you can remove the parentheses so that the text appears just as you want it to appear in the acronym list. If you use the above method to mark only the first instance of the acronym—where it is first defined—then there will be a single page number for each acronym in your list. If you like the idea of having page numbers, but want them for all instances of each acronym, then you'll need to mark each occurrence of the acronyms—a much more involved task.

If you prefer not to use the either of the methods already described, you could create a macro that will aid you in creating your acronym list. The following macro essentially copies whatever text you have highlighted to the end of the document.

Sub Send_2_acronym_list()
    With ActiveDocument.Bookmarks
        .Add Range:=Selection.Range, Name:="xxxHERExxx"
        .DefaultSorting = wdSortByName
        .ShowHidden = True
    End With
    Selection.Copy
    Selection.EndKey Unit:=wdStory
    Selection.TypeParagraph
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.GoTo What:=wdGoToBookmark, Name:="xxxHERExxx"
    Application.Run MacroName:="Normal.MoreNewMacros.EditGoTo"
    Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

The idea is to select your first instance of the acronym, along with its definition, and then invoke the macro. A bookmark is set at the current location, the text is copied, the end of the document is selected, and the text added there. Then the bookmark is used so that the original location can again be selected.

When you are done "marking" your acronyms in this manner, you can select the text that was copied to the end of the document and format it (or edit it) in any way desired.

If you want an approach that is even more automated, then you may be able to create a macro that will scan through your document and extract any acronyms it finds. In order for an approach like this to work, you'll need to make sure that you religiously follow a rigid structure for your acronyms and their definitions. The following macro assumes that the acronym will always be a string of uppercase letters followed by a space and then some parenthetical text.

Sub ListAcronyms()
    Dim strAcronym As String
    Dim strDefine As String
    Dim strOutput As String
    Dim newDoc As Document

    Application.ScreenUpdating = False
    Selection.HomeKey Unit:=wdStory
    ActiveWindow.View.ShowHiddenText = False

   'Loop to find all acronyms
    Do
        'Search for acronyms using wildcards
        Selection.Find.ClearFormatting
        With Selection.Find
            .ClearFormatting
            .Text = "<[A-Z]@[A-Z]>"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindStop
            .Format = False
            .MatchCase = True
            .MatchWildcards = True
            .MatchWholeWord = True
            .Execute
        End With

        'Only process if something found
        If Selection.Find.Found Then
            'Make a string from the selection, add it to the
            'output string
            strAcronym = Selection.Text

            'Look for definition
            Selection.MoveRight Unit:=wdWord
            Selection.MoveRight Unit:=wdCharacter, _
              Extend:=wdExtend
            strDefine = ""
            If Selection.Text = "(" Then
                While Selection <> ")"
                    strDefine = strDefine & Selection.Text
                    Selection.Collapse Direction:=wdCollapseEnd
                    Selection.MoveRight Unit:=wdCharacter, _
                      Extend:=wdExtend
                Wend
            End If
            Selection.Collapse Direction:=wdCollapseEnd
            If Left(strDefine, 1) = "(" Then
                strDefine = Mid(strDefine, 2, Len(strDefine))
            End If
            If strDefine > "" Then
                'Check if the search result is in the Output string
                'if it is, ignore the search result
                If InStr(strOutput, strAcronym) = 0 Then
                    strOutput = strOutput & strAcronym _
                      & vbTab & strDefine & vbCr
                End If
            End If
        End If
    Loop Until Not Selection.Find.Found

    'Create new document and change active document
    Set newDoc = Documents.Add

    'Insert the text
    Selection.TypeText Text:=strOutput

    'Sort it
    newDoc.Content.Sort SortOrder:=wdSortOrderAscending
    Application.ScreenUpdating = True
    Selection.HomeKey Unit:=wdStory
End Sub

The macro looks through the document for anything it thinks might be an acronym. If it finds a candidate, it looks after it to see if it is followed by an opening parenthesis. If so, then everything up to the closing parenthesis is considered the definition for the acronym. Once the macro is finished going through the document, it creates a new document, adds the acronyms there, and then sorts them all.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (446) 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: Auto Creation of an Acronym List.

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

Deleting a Macro

Macros are often created to accomplish a specific task, after which they are no longer needed. If you need to delete a macro ...

Discover More

Filling A Drawing Object

Creating a drawing object can be just the first step in putting together your masterpiece drawing. This tip explains how you ...

Discover More

Changing Measurement Units

When working in Word's dialog boxes, most people understand that you should enter measurements using inches. If you don't ...

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)

Starting a Discussion

Tips for getting your Discussion started.

Discover More

Can't Place Merge Field in Header Of a Catalog Merge Document

Word can perform several different types of mail merge operations, and the type you choose can affect how you are able to use ...

Discover More

Inserting a Sound File in Your Document

Got an audio file you want to insert in your document? It's easy to do when you use the Object dialog box, as described in ...

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 7 + 6?

2016-02-02 11:42:24

rose

i see a lot of great questions in this thread and no answers. i edit technical documents, and use a format with the description first, and acronym in parentheses afterward, for the first instance. ever after, only the capitalized acronym is listed.

i want to be able to identify the first instance, and force all other instances to only appear as the acronym.

i also want to be able to auto-populate a table with all acronyms.

i don't know how to modify the provided macro to serve the format i'm required to use. please help! and thanks!


2015-06-11 14:41:52

RR

Hi,
In some projects, the definition comes before the acronym, for example "United States (US)". Can anyone please tell me how to modify this macro to have it achieve the same task but with the definition and acronym in parentheses reversed?

Thanks!


2015-05-14 13:58:00

Kristen

I modified this a bit to suit my purposes. I need to capture some acronyms that may have a plural (lower case 's' at the end, like 'PCBs') or periods (U.S.A.). So I used a little more complicated RegEx:

.Text = "<[A-Z]@[A-Z.][A-Zs]>"

I think this is only giving me abbreviations that are more than 2 characters, which is fine for my purposes.

I'm using it to QC acronym and abbreviation lists for technical documents, and the biggest drawback is that it doesn't capture lower case abbreviations, like ppm or cm.


2014-12-10 03:37:12

Karthigeyan

Hi,

I did a simpler way. I went to find and replace. I found all the words that are fully capitalized by using wildcards <[A-Z]{2,}>. In Replace i changed the font to a font that i did not use in the document. Replaced all with the selection. Then made a select all suiting this style, copied and pasted it in a notepad. From notepad, copied the text into MS Excel where i removed the duplicated entries and sorted it.

Now my list is ready to be plugged back in word.


2014-12-04 18:56:46

Mark Hnatyszyn

I am also looking for an easy way to identify all acronyms in a doc by putting them in a list. I can then create the Glossary myself without fear of missing anything. Can you help, thanks...


2014-10-17 11:43:12

dcarrier

I need to do what Scott did but I think I deleted incorrectly. Can anyone post the solution without the definitions, so I will generate just the list of acronyms?

thanks!


2013-07-19 19:23:14

Chris

Hi,
I get an error - 5820
on this line.
newDoc.Content.Sort SortOrder:=wdSortOrderAscending

I have Word 2007, Win XP (Japanese) OS but I also set the default document type to English.


Chris


2013-06-07 16:53:10

Jeremy A

We do acronyms differently. ex. United States of America (USA). I do not even need the definition, just a list of the aacronym would be helpful. How would a macro for that look?


2012-05-08 18:54:49

Scott Gremmert

Kudos! I only needed the macro to generate *list* of Acronyms, so I hacked out the part in the middle that dealt with definitions and the result worked perfectly first time. You saved me a ton of effort. Thanks!


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.

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.