I review long documents with thousands of acronyms and need to create a list of all the acronyms. I found this code on another site but am unable to run it against a small Word doc I get "Compile error User-defined type not defined" Not sure what I need to change
Code:
Sub Acronyms()
Dim dict, k, tmp
Dim regExp, Match, Matches
Dim rngRange As Range
Set regEX = New regExp
Set dict = CreateObject("scripting.dictionary")
regEX.Pattern = "[A-Z]{2,}" '2 or more upper-case letters
regEX.IgnoreCase = False
regEX.Global = True
Set Matches = regEX.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
For Each k In dict.Keys
Debug.Print k, dict(k)
Next k
End Sub
Thanks in advance for your help, I am very new to VBA
Dave