I was working on my Master’s thesis draft in Microsoft Word. I needed a complete list of all abbreviations for the front matter.
The document covers deep learning and time-series forecasting. I had also analysed many of the papers in NotebookLM with custom prompts. As a result, the text was full of acronyms:
CNN
LSTM
MAE
RMSE
RNN
Finding them by hand was going to take forever. Some appeared once. Others appeared dozens of times. Scrolling through a hundred pages looking for capital letters was not an option.
Word’s Find tool can help. But I wanted a clean list I could copy, sort, and edit.
I already used a small script to keep PDF numbering in Zotero for fast Word citations. So I wrote a small VBA macro to handle this job too.
First, Microsoft Word Can Find Uppercase Words
Microsoft Word has built-in wildcard search.
Press:
Ctrl + H → More → Use wildcards
Then search for:
<[A-Z]{2,}>
This finds words with two or more capital letters.
It works surprisingly well for abbreviations. But it has two main problems.
First, it catches normal words written in all caps. Depending on the document, you might get:
ACCESS
FORECASTING
INDEX
TIME
USING
Second, it finds every single match. If RMSE appears 30 times, you get 30 results.
I wanted something cleaner. I needed a unique, sorted list.
Using a Small VBA Macro to Extract Abbreviations
Word has VBA built in. You do not need to install any add-ins.
Press:
Alt + F11
Then click:
Insert → Module
Paste this macro:
Sub FindAllAbbreviations()
Dim doc As Document
Dim newDoc As Document
Dim rng As Range
Dim dict As Object
Dim items() As String
Dim temp As String
Dim i As Long, j As Long
Dim key As Variant
Set doc = ActiveDocument
Set dict = CreateObject("Scripting.Dictionary")
Set rng = doc.Content
With rng.Find
.ClearFormatting
.Text = "<[A-Z]{2,}>"
.MatchWildcards = True
.Forward = True
.Wrap = wdFindStop
Do While .Execute
temp = Trim(rng.Text)
If Not dict.Exists(temp) Then
dict.Add temp, temp
End If
rng.Collapse wdCollapseEnd
Loop
End With
If dict.Count = 0 Then
MsgBox "No abbreviations found."
Exit Sub
End If
ReDim items(0 To dict.Count - 1)
i = 0
For Each key In dict.Keys
items(i) = key
i = i + 1
Next key
' Sort alphabetically
For i = LBound(items) To UBound(items) - 1
For j = i + 1 To UBound(items)
If UCase(items(i)) > UCase(items(j)) Then
temp = items(i)
items(i) = items(j)
items(j) = temp
End If
Next j
Next i
' Create a new document
Set newDoc = Documents.Add
newDoc.Content.InsertAfter "Abbreviations" & vbCrLf & vbCrLf
For i = LBound(items) To UBound(items)
newDoc.Content.InsertAfter items(i) & vbCrLf
Next i
MsgBox dict.Count & " unique abbreviations found."
End Sub
Then press:
Alt + F8
Select FindAllAbbreviations, and click Run.
What It Does
The macro skips duplicate words. It keeps only unique values.
If your document has:
LSTM
RMSE
CNN
LSTM
MAE
RMSE
CNN
the output becomes:
CNN
LSTM
MAE
RMSE
It sorts the full list from A to Z. Then it pastes the list into a new Word document.
Your original document stays untouched.
It Is Not Perfect
The macro does not understand language.
It only knows one rule:
This looks like an uppercase word.
It can still pick up capitalized headings, company names, journal titles, or Roman numerals.
My first run had several of these.
I still had to review the final list and delete the obvious mistakes.
That was fine by me. Cleaning up 30 unique items took two minutes. That is much better than searching hundreds of pages by hand.
Finding Abbreviations Inside Parentheses
Here is another trick if you introduce acronyms in brackets:
Root Mean Squared Error (RMSE)
Long Short-Term Memory (LSTM)
In Word wildcard search, use:
\([A-Z]{2,}\)
This looks only for uppercase text inside parentheses.
The result is usually much cleaner. Headings and all-caps words rarely sit inside brackets.
It matches items like:
(RMSE)
(LSTM)
(CNN)
It ignores uppercase words in the rest of the text.
To use this in the macro, change .Text = "<[A-Z]{2,}>" to .Text = "\([A-Z]{2,}\)".
What I Ended Up Doing
I ran the macro to get an initial list. Then I removed the false matches by hand. Finally, I checked the remaining items against my text.
It is not fully automatic.
But it turns a slow, boring chore into a two-minute cleanup.
Sometimes that is all the automation you need.
