View Single Post
 
Old 02-12-2019, 03:43 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Why not simply loop through all the cross-references? For example:
Code:
Sub Demo()
Dim Fld As Field, StrWrd As String
StrWrd = InputBox("Input the string to find")
With ActiveDocument
  For Each Fld In .Fields
    With Fld
      If .Type = wdFieldRef Then
        If InStr(.Result, StrWrd) > 0 Then
          MsgBox StrWrd & " can be found in a field"
          Exit Sub
        End If
      End If
    End With
  Next
End With
End Sub
There are also far more efficient ways of finding coloured text...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote