Hello,
I am trying to find text in a table and then execute a command which involves focusing on a new selection/range. I know the change is my issue but I do not know how to overcome it. Any ideas??
Code:
With ActiveDocument
Selection.Find.ClearFormatting
With Selection.Find
.Text = "TOC"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
While .Execute
.MoveDown Unit:=wdLine, Count:=1
.SelectCell
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
EntryAutoText:=SelectedText, CrossReference:="", CrossReferenceAutoText:="", _
BookmarkName:="", Bold:=False, Italic:=False
Wend
End With
Thanks!