Apr 30 2022 01:35 PM - edited May 01 2022 12:27 AM
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 problem using the well known solution: adding a special symbol at the end of each table cell by replacing formatted text in tables with ^&§§§, etc. but it's not efficient enough, I'm looking for something better.]
Thank you for your suggestions.
May 01 2022 04:02 PM
@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
May 01 2022 11:41 PM
May 02 2022 03:36 AM
May 02 2022 04:00 AM