I have this code and it's getting stuck in a loop. I have similar codes and it loops through the doc changing each word only once. When I run this sub it sticks on the first instance and replaces the text over and over.
I want it to find the word "therefore" and if the previous "word" = ; to skip, otherwise change to "therefore (needs joined with ;)".
What am I missing/doing wrong?
Thanks in advance!
Sub test()
Dim wrd As Range
For Each wrd In ActiveDocument.Words
If InStr(1, wrd, "therefore") <> 0 Then
If InStr(1, wrd.Previous(Unit:=wdWord, Count:=1).Text, ";") <> 0 Then
Else
wrd.Text = "therefore (needs joined with ;)"
End If
End If
Next
End Sub