Forum Discussion
Funfunfan
Apr 30, 2022Copper Contributor
How to find & replace text in tables only in word 2003?
Hello, I want to find and replace text in tables only, without affecting the rest of the text. I tried various solutions found on the internet, but they don't work in my case. [I've solved this pr...
May 01, 2022
Funfunfan Use a macro containing the following code
Dim strReplace As String
Dim strFind As String
strFind = InputBox("Insert the text to be replaced")
strReplace = InputBox("Insert the replacement text")
Selection.HomeKey wdStory
With Selection.Find
Do While .Execute(FindText:=strFind, Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=True) = True
If Selection.Information(wdWithInTable) = True Then
Selection.Text = strReplace
Else
Selection.Collapse wdCollapseEnd
End If
Loop
End With
- FunfunfanMay 02, 2022Copper ContributorThank you. It only replaces one instance. I need the Replace All function working in tables only.
- May 02, 2022Replace
Wrap:=wdFindStop
with
Wrap:=wdFindContinue
Avoid making a replacement such as Testing for Test- FunfunfanMay 02, 2022Copper ContributorThanks. It worked, but for some reason each time I apply this, the same portion of the text that is not in table starts flashing, and after 5 or 10 seconds word goes into Not responding mode and brings out the Close program dialog.