I have modified the code slightly as I realized it was not drawing in acronyms that contained a number and am getting an error on the Set Matches line that state "application-defined or object define error. I suspect it is because I am no longer searching for just text. What is the member of range that include both text and numbers? Nothing jumps out at me
Code:
Sub Acronyms()
Dim dict, k, tmp
Dim regExp, Match, Matches
Dim oDoc As Document
Set regExp = CreateObject("vbscript.regexp")
Set dict = CreateObject("scripting.dictionary")
regExp.Pattern = "\([A-Z][A-Za-z0-9]@\" '2 or more upper case letters/numbers
regExp.IgnoreCase = False
regExp.Global = True
Set Matches = regExp.Execute(ActiveDocument.Range.Text)
For Each Match In Matches
tmp = Match.Value
If Not dict.Exists(tmp) Then dict.Add tmp, 0
dict(tmp) = dict(tmp) + 1
Next
Set oDoc = Documents.Add
For Each k In dict.Keys
'Debug.Print k, dict(k)
oDoc.Range.InsertAfter k & ", " & dict(k) & vbCr
Next k
oDoc.Range.Paragraphs.Last.Range.Delete
oDoc.Range.Sort
End Sub