Function search()
Dim list() As String
Dim Wrd As String
Dim k As Integer
Dim Nfound As Boolean
Dim Def As String
Dim location() As String
'Search document and get locations of each instance of a word
Wrd = "ABC" 'Get next word from list
Def = "Alphabet"
k = 1
Dim DocRng
Set DocRng = ActiveDocument.Content 'search whole document
With DocRng.find
.Text = Wrd
.MatchCase = True
Do While .Execute 'For each entry found, store start and end to array
ReDim Preserve location(2, k)
location(1, k) = DocRng.Start
location(2, k) = DocRng.End
k = k + 1
Loop
End With
'Compare the found locations against the current selection and select the first instance after current selection
Nfound = True 'Set as not found until it is found
j = Selection.End 'mark current cursor location
For k = 1 To UBound(location, 2)
If location(1, k) > j + Len(Def) Then '+ Len(Def) accounts for changes to text
ActiveDocument.Range(Start:=location(1, k), End:=location(2, k)).Select
Nfound = False
Exit For
End If
Next
If Nfound Then 'if not found got to first instance found
k = 1
ActiveDocument.Range(Start:=location(1, k), End:=location(2, k)).Select
End If
End Function