• Create Acronym List – How (Word 2000/SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Create Acronym List – How (Word 2000/SR1)

    Author
    Topic
    #378333

    I work in a group that does a lot of proposals for different products, always quick turnarounds. Writers use acronyms and we often need to create a quick list to define them for the customer. Now we manually copy/paste into a new document. I need a macro for this but if I can’t record it, I’m lost.

    Does anyone already do this? Thought about applying a character style to what I wanted copied and pasted into new doc, but how do you get Word to collect and put entries somewhere (end of doc, new doc)?

    I’d appreciate any help or ideas. Thanks.

    Nancy Potter

    Viewing 4 reply threads
    Author
    Replies
    • #625881

      Is this a shared list that doesn’t change very often, or is it something that people are constantly updating? If it’s the former, a document that you simply include in each proposal could be used. If it’s the latter, you might look at putting some sort of list into a database (Access?) that supports multiple users making updates, and then push the results of a query (or the whole table) out to Word. We actually built a proposal generator for one of our clients that does most of the work of creating a proposal in Word but drive it from an Access database, and found that it works pretty well

      • #625885

        Each proposal has its own set of acronyms (some are the same, some not ). Engineers here use a lot of acronyms, and we’ve run into some with duplicate meanings (acronym may have been defined as something else in the last proposal). We would only want the ones listed that are included in the current documents so I would have to get them from current docs.

        Nancy Potter

    • #626417

      I’m a proposal writer working on tech/engineering docs, too. I always include a glossary of acronyms and jargon, but I use the index feature combined with the autotext feature to compile it. Yes, this takes a bit more planning and isn’t something you can easily impose on an already completed document, but it’s worth the time to set up if you handle the same abbreviations day in and day out.

      First, I add my common abbreviations to my autotext collection, but I add them along with embedded fields created using the Insert/Index and Tables/Mark Entry command (with a little bit of tweaking). For example, here would be my autotext entries for the terms of art, Usless Abbreviation, and Another One:

      Useless Abbreviation (UA { XE “UA” t “Useless Abbreviation” })
      Another One (AO {XE “AO” t “Another One” })

      Remember, the { }s are generated as part of the mark-entry field tag, and are not typed as keyboard characters. In the doc with view hidden text off, these two lines look like this:

      Useless Abbreviation (UA)
      Another One (AO)

      The first time I use the abbreviation in my doc I use the autotext feature to call in my entry with its companion hidden indexing field. That establishes the abbreviation and its definition in my text. After that, I just type my UAs or AOs off the keyboard. One time or uncommon items I cheat-create, usually by calling up a known abbreviation/definition pair and editing the field. If I think I’ll be using it again, I add the new entry to autotext.

      Once I’ve got the document underway, I get to the end and hit an Odd Page section break (we do everything double-sided); format a heading for Glossary, and use the Insert/index and tables feature to put an index-here field code in my text (I tweak that a bit, too). The code I use is:

      { INDEX c “2” h “A” )

      Again, the {}s come from field codes, not typing.

      What I get is a two-column alphabetized list of all of my abbreviations, each with its companion definition, and with alphabetic divider characters parsing the list.

      While this isn’t a true “power users” tip (it’s pretty elementary), many people I’ve worked with have been surprised that you can use the indexing feature to build an info list that doesn’t include page numbers.

      Extra hint: I’ve also used this feature to keep track of assignments. I put the item number or name in place of the abbreviation and the assignee’s name in the place of the full text definition in the fields above. I erase the field when the input comes in. One button press, and I know who still owes me material.

      Hope this helps someone,

      kbsalazar snail

    • #626956

      I use the macro below to build a list of misspelled words. It, or a variation of it, might be useful for building acronym lists.

      Used as is, it would pull out those acronyms that are not in the built-in or custom dictionary. Useful, but it misses such acronyms as Point of Presence (POP).

      The line “Set preList = rngMacro.SpellingErrors” could be followed by (or replaced with) a loop that scans the document for words in all capitals. I’d recommend making a list of all cap words + misspellings. The former would pick up POP and the latter DoD (Department of Defense). Alternatively, the test in the loop could look for all words with odd capitalization.

      The use of a list object (ProofreadingErrors) is handy because it automatically eliminates duplicates.

      The last bit of code shows you how to put the list into a new document. From there you can cut/paste it wherever you want. It wouldn’t be hard to expand the code in that loop to format the list neatly. With a bit more code, you could read in a list of standard acronym entries and use this loop to drop in the definitions. Some work to set up, but a big time saver when used.

      Hope these ideas help.

      Sub ListMisspelledWords()
          Dim lstUnknowns As Dictionary
          Dim rngMacro As Range
          Dim preList As ProofreadingErrors
          Dim rngWord As Range
      
      	' Turn off screen updating to speed macro
          Application.ScreenUpdating = False
      
      	' Run only on selected text if there is any
      	' Otherwise process the whole document
          If (Selection.Range.Start = Selection.Range.End) Then
              Set rngMacro = ActiveDocument.Range
          Else
              Set rngMacro = Selection.Range
          End If
      
      	' Get the list of misspelled words
          Set preList = rngMacro.SpellingErrors
      
      	' Put the list into a new document
          Documents.Add Template:="Normal", NewTemplate:=False
          For Each rngWord In preList
              Selection.TypeText rngWord
              Selection.TypeParagraph
              Next rngWord
      
      	' Turn screen updating back on
          Application.ScreenUpdating = True
      End Sub
      
    • #627027

      Well there has been a lot of responses on this thread but no-one has suggested using wildcards to find the strings.

      I would be looking at modifying one of the suggested macros to search using wildcards for a string such as “<[A-Z,0-9]{2,}" which will find anything in capitals including digits. If you didn't use acronyms such as TF2 or W3C then the string "<[A-Z]{2,}" would be better as it would exclude false hits such as 666.

    • #625904

      Nancy

      [Post editted Nov 10th to include StuartR’s change to put items at the end]

      I do this. I format all Acronym entries as Italics and then ‘collect’ them into a glossary at the tail of my file.

      In Office XP this is trivial because the find command allows you to “select all” found items and its a simple Copy to clipboard.

      I just coded a Macro in 2000 which is fairly simplistic and dumb. It sets up a search for Italics, collects them all together and inserts them at the back of the document.
      I suspect an expert could do it lots more elegantly. (I’m assuming that you can modify or change this for table formatting or whatever.)

      cheers

      Sub AcronymBuilder

      Dim MyAcronyms As String
      Selection.WholeStory
      Selection.MoveLeft Unit:=wdCharacter, Count:=1
      Selection.Find.ClearFormatting
      Selection.Find.Font.Italic = True
      With Selection.Find
      .Text = “”
      .Replacement.Text = “”
      .Forward = True
      .Wrap = wdFindContinue
      .Format = True
      .MatchCase = False
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
      End With

      While Selection.Find.Execute = True
      MyAcronyms = MyAcronyms + vbCrLf + Selection
      Wend
      ActiveDocument.Content.InsertAfter _
      MyAcronyms & vbCrLf
      End Sub

      • #625979

        Andrew,

        How can you get the Find command to select all in XP?

        I’ve had some trouble with something similar. We have documents with hidden text to give explantions to the user (we turn on the View Hidden text option). We want to remove the hidden text before the document is closed.

        We’ve been doing this in W2000 for a long time with code:

        Selection.Find.ClearFormatting
        Selection.Find.Font.Hidden = True
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = ""
            .Replacement.Text = "@#|^p"
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = "@#|^p"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll

        Sometimes, this clears all the NON-HIDDEN text. But it’s intermittent. I was hoping that the selectall option might help. Or perhaps there’s another way to do this?

        • #625982

          Geoff

          Use the normal Edit > Find and fill in your search criteria

          Tick the check box labelled “Highlight all items found in:”

          Click the button that now says “Find all”

          Voila

          • #626020

            OK Andrew, I was looking in the replace dialog box. I’ll check it out tomorrow. Thanks for that.

          • #626393

            Andrew,

            Forgive me please. I’m in the middle of a major project – and this one is just a little one trying to interfere!

            I’ve only had about ten minutes on Word XP to try to repoduce.

            In my limited time, I could not reproduce the “Highlight all items” feature by recording code. And I could not find a VBA equivalent in the “Selection.Find” object.

            (That’s not just an XP thing- recording “Find hidden formatting” doe snot recdord anything in Word 2000 either)

            Thanks

        • #626571

          Getting rid of hidden text. I didn’t quite understand why you needed a two stage process – one does it fine on my version of 2000 or 2002.
          What’s wrong with simply searching for character format = hidden, and doing a ‘replace all’ with the null string?

          If it is a VBA requirement then

          Selection.Find.ClearFormatting
          Selection.Find.Font.Hidden = True
          Selection.Find.Replacement.ClearFormatting
          With Selection.Find
          .Text = “”
          .Replacement.Text = “”
          .Forward = True
          .Wrap = wdFindContinue
          .Format = True
          .MatchCase = False
          .MatchWholeWord = False
          .MatchWildcards = False
          .MatchSoundsLike = False
          .MatchAllWordForms = False
          End With
          Selection.Find.Execute Replace:=wdReplaceAll

          Should do it.
          The find-all variant, as a Macro, looks simpler because it is not followed by a filtering method such as execute.replace

          Selection.Find.ClearFormatting
          With Selection.Find
          .Text = “fox”
          .Replacement.Text = “”
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchWildcards = False
          .MatchSoundsLike = False
          .MatchAllWordForms = False
          End With
          Selection.Cut

          • #626915

            Oliver,

            I can’t remember why it was a two stage process. It was written in Word97, I don’t know if that made any difference.

            I’d like to start this off as a new thread.

      • #626124

        Andrew:

        I tried it and it works great (substituted style name instead of font.italic, but I had to go back to a macro I recorded to get the correct wording ( the first time I tried it I got a runtime error). Sure wish I knew how to write these things!

        Now for a really dumb question — What do I do to get it to paste at end of document instead of at the front? I know words “InsertBefore _” have to be replaced, but I’m not sure what to use. It works now and I don’t want to screw it up!

        Wend
        ActiveDocument.Paragraphs(1).Range.InsertBefore _
        MyAcronyms & vbCrLf

        I really appreciate your taking the time to help me.

        Nancy

        • #626131

          Try using
          ActiveDocument.Content.InsertAfter

          StuartR

          • #626165

            Thanks. This is great!

            Nancy

          • #630443

            Moving in on this thread at a late date, it does exactly what I have been attempting for ages and I also wish to collect the marked text entries at the end of the document on a new page, BUT – I have deleted the line >ActiveDocument.Paragraphs(1).Range.InsertBefore _ActiveDocument.Content.InsertAfter< in its place. It crashes crybaby Why !

            • #630444

              > It crashes Why !

              Oh dear! Could be document corruption, could be a microsoft bug, could be a mistake in how you have transcribed the code. Here are some things to do that might give us a bit more information so we can help you…

              • Run the original macro, does it work properly
              • Add the ActiveDocument.Content.InsertAfter without deleting the other line. Does it still crash?
              • Remove the ActiveDocument.Paragraphs(1).Range.InsertBefore without adding the other line. Does it still crash?
              • Run the Macro against a different document. Does it still crash?
                [/list]StuartR
            • #630480

              Hi Stuart
              It would appear that Nancys worked OK, thats what I am assuming from her reply, mine doesn’t.
              I am attaching a word doc which I hope answers the questions you posed me.

            • #630495

              Mike

              It was a syntax issue.

              That replaced line had a continuation character “_” which effectively ‘wrapped’ the statement to the next line.

              Replace it with

              ActiveDocument.Content.InsertAfter _

              where the “_” is important to inform Word to also wrap your inserted line.

              I’ve gone back and modified the original post to use StuartR’s suggestion so that this will not happen to others.

            • #630521

              Andrew
              Great, works a treat, thank you. clapping. Must learn the tricks of VBA, any suggestions on suitable documentation.

            • #630553

              Mike

              Glad it worked for you. I learnt my best VBA right here! compute
              I’m not really a documentation reader – but I vaguely remember a thread went by in the last week or two on that topic.

              To learn, you’re best off simply trying things that attract your curiosity. Woody’s Lounge has experts from all over and is a great place to start –
              keep following messages that interest you, and treat the offerings as rich learning.
              If in doubt, fire up VBA and look up Help on the features being used.

              To learn, you’re best off simply trying things that attract your curiosity. crossfingers
              Using Macro recording is a good start – although it writes awful (but working) code.

              Attempting something (and asking here when stuck) is much more likely to pay dividends than just reading theory.

              As a late starter on VBA I assure you that its objects, properties and methods are (in my opinion) close to illogical – it is not until you see an expert use a ‘trick’ that you suddenly realise how to do something.

              The other thing is that you’ll make mistakes – we all do. Just make sure that you do your tests on files that don’t matter (such as copies).

              Footnote: The reason I do not read ‘standard’ documentation.
              A typical piece of documentation says “Use the Widget statement to widgetize. You can choose between extreme widgitization and slow widgitization by coding the Processing:= wdWidgitize parameter”
              Not useful. Most third party ‘helpful’ documentation simply parrots the above useless “How to” formula, rather than the more useful “Why to” or “Cookbook” methods that you will see here in the Lounge.

    Viewing 4 reply threads
    Reply To: Reply #630495 in Create Acronym List – How (Word 2000/SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel