Hi,
like this, unless "name" appears a million times
outside of tables. In that case it would be better,
to restrict the search to the tables only.
Sub test5867()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
ResetSearch
With rDcm.Find
.Text = "name"
.MatchCase = True
.MatchWholeWord = True
While .Execute
If rDcm.Information(wdWithInTable) Then
rDcm.Select
Exit Sub
End If
Wend
End With
ResetSearch
End Sub
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub
And please let us know, whether this was helpful.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Helmut Weber - 28 Jul 2005 13:24 GMT
> If rDcm.Information(wdWithInTable) Then
> rDcm.Select ' for testing
rdcm.tables(1).select ' ---- add this line ----
> Exit Sub
Helmut Weber