Below is the current code (which I adapted from code I found online):
Code:
Selection.HomeKey Unit:=wdStory ' line 1
For Each rngRange In ActiveDocument.StoryRanges ' line 2For Each rngSentence In rngRange.Sentences ' line 3For Each rngWord In rngSentence.Words ' line 4rngWord.Select ' line 5
SelectedText = Selection.Text ' line 6
If Right(SelectedText, 2) = "[A-Z][A-Z]" Then ' line 7
Else ' line 8
End If ' line 9
Next rngWord ' line 10
Next rngSentence ' line 11
Next rngRange ' line 12
In line 7 above, I'm trying to get the macro to identify the types of text strings I'm looking for (e.g., BC-3, ABC-5, BC-003, DA-378-A). I realize that maybe the For Each...Next (word) is not the best way to go about this, but it seems to work pretty well (as the main approach vs. using the Find approach).
Should I forget about the For Each...Next approach and stick with the Find approach?
Thanks