If the heading uses a Heading Style (or some other Style whose scope is limited to headings), simply use Find/Replace to look for the Style as part of the Find parameters, then test whether it's in a table and, if so, get the cell's RowIndex - if it's 1 it's on the first row, and if it's 2 it's on the second row, thus:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = InputBox("What is the Text to Find")
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.Style = "Heading 1"
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
If .Information(wdWithInTable) Then
If .Cells(1).RowIndex < 3 Then
'Do something with the heading
MsgBox .Text
End If
ElseIf .End = ActiveDocument.Range.End Then
Exit Sub
End If
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
Even without employing Styles, you can still use the same general approach.