I have some code that will format text within brackets to italics. I would like to modify the code to look for text in brackets only if they appear after a cross reference field or a cross reference manual number after clause, paragraph, part or schedule and format with italics. What do I need to add to the code to achieve this? Any advice would be very much appreciated.
Before Image.JPG
After Image.JPG
Cross Ref in Brackets Test.docx
Code:
Sub DPU_BracketText_Italics()
Dim oRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
.ClearFormatting
.text = "\(*\)"
.Font.Bold = False
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Format = True
Do While .Execute
With oRng
.MoveEnd Unit:=wdCharacter, count:=-1
.MoveStart Unit:=wdCharacter, count:=1
.Font.Italic = True
.Font.Bold = False
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub