Thank you, Greg, for your remarks! I fully accept them. My final code taking advantage of your suggestions (If conditions can be replaced wih Case conditions):
Code:
Sub Find_N_Embolden()
'In selection, embolden all '@AnyNumberOfCapitals' or
''@AnyNumberOfCapitals_DigitDigitNotFollowedByDigitOrLetter'.
Dim oRng As range
Dim FindTxt As String
Application.ScreenUpdating = False
Set oRng = Selection.range
FindTxt = "\@[A-Z]{1,}"
Do
With oRng.Find
.text = FindTxt
.MatchWildcards = True
.Forward = True
.Wrap = wdFindStop
If .Execute And oRng.InRange(Selection.range) Then
If oRng.End >= ActiveDocument.range.End - 4 Then
oRng.Font.Bold = True: GoTo lbl_Next
ElseIf oRng.Characters.Last.Next <> "_" Then
oRng.Font.Bold = True: GoTo lbl_Next
ElseIf Right(ActiveDocument.range(oRng.start, oRng.End + 4), 4) Like "_[0-9][0-9][!A-Za-z0-9]" Then
oRng.MoveEnd unit:=wdCharacter, count:=3
oRng.Font.Bold = True: GoTo lbl_Next
Else: GoTo lbl_Next
End If
Else
Exit Do
End If
End With
lbl_Next:
oRng.Collapse wdCollapseEnd
Loop
Application.ScreenUpdating = True
Set oRng = Nothing
End Sub