Thank you. Please pardon my delay in responding. No excuses; I just got overly busy. I certainly appreciate your work.
The revised macro still throws a runtime error #91, object variable or with block variable not set error when there is more than one line containing an acronym that comes before the first list. For example, in your demo document, add a second line that says, "New line BBB." When the macro is run it errors out at, "Set oRngLP = oRngLP.Paragraphs(1).Previous.Range". My workaround is just to make the first line a list and change it back after the macro runs, but I thought I'd let you know in case others are following this thread.
Then a couple of last thoughts/requests, which are by no means important but would make the macro pretty slick. (1) Sometimes I want listed the appearance of every acronym regardless of how many times it appears. Sometimes (most often) I only want to output the first appearance of an acronym. I wonder if there is an easy way to add code that would restrict the output to only the first instance of the acronym and then comment out the code if I want to output every instance. If it's not easy to do then I can just sort and delete the extras, which is what I have been doing. (2) In using your macro I noted that where I have a sentence or paragraph where every character is in uppercase then all the words 'n' characters in length will be output as acronyms. So I replaced the .text code you had with: .Text = "\([A-Z]{2,}\)" This allows me to only capture acronyms contained within parenthesis. Do you see any issue with this modification?
|