Only replace a first row in every table and shouldn't get replaced in any where else in a document...
I have tried the below one, can you review the range once.
Range is first row of a every table. (It shouldnt get replaced otherthan a first row of a tables)
Code:
Sub Test_Replace()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "sample"
.Replacement.Text = "Sample"
.Format = False
.Forward = False
.Wrap = wdFindStop
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
Do While .Find.Execute
If .Information(wdWithInTable) = True Then
Set Rng = ActiveDocument.Tables(1).Cell(1, 0)
Do While Rng.Tables.Count > 0
Loop
Exit Do
End If
.Collapse wdCollapseStart
Loop
End With
Application.ScreenUpdating = True
End Sub