I wrote a vba macro to remove the words Table and Figure from a Table of Figures ToC that has ?already been updated and to drop the period space space and replace it with a tab. It works, but I ?would like to add ^13 (paragraph mark) before Table or Figure into the code so that the paragraph ?mark is selected along with Table or Figure, but the macro does not work if the ToC contains a \h ??(hyperlink). Our ToCs now require hyperlinks. Does anyone know what needs to change in the code to ?be able to find the paragraph mark with the words Table or Figure? ?
The ^13 works with no \h in the ToC: ^13(Table )([0-9][0-9])(. )(*^t)?
Sub FND_TableSp_RPLC_Blank_WithSlashH()?
? Selection.SelectCell
? Selection.Find.ClearFormatting
? Selection.Find.Replacement.ClearFormatting
? With Selection.Find
? .Text = "(Table )([0-9])(. )(*^t)"?
? .Replacement.Text = "\2^t\4"?
? .Forward = True?
? .Wrap = wdFindStop?
? .Format = True?
? .MatchCase = False?
? .MatchWholeWord = False?
? .MatchAllWordForms = False?
? .MatchSoundsLike = False?
? .MatchWildcards = True?
? End With
? Selection.Find.Execute Replace:=wdReplaceAll
? ?
? Selection.SelectCell
? Selection.Find.ClearFormatting
? Selection.Find.Replacement.ClearFormatting
? With Selection.Find
? .Text = "(Table )([0-9][0-9])(. )(*^t)"?
? .Replacement.Text = "\2^t\4"?
? .Forward = True?
? .Wrap = wdFindStop?
? .Format = True?
? .MatchCase = False?
? .MatchWholeWord = False?
? .MatchAllWordForms = False?
? .MatchSoundsLike = False?
? .MatchWildcards = True?
? End With
? Selection.Find.Execute Replace:=wdReplaceAll
End Sub
The ^13 works with no \h in the ToC: ^13(Table )([0-9][0-9])(. )(*^t)?
Sub FND_TableSp_RPLC_Blank_WithSlashH()?
? Selection.SelectCell
? Selection.Find.ClearFormatting
? Selection.Find.Replacement.ClearFormatting
? With Selection.Find
? .Text = "(Table )([0-9])(. )(*^t)"?
? .Replacement.Text = "\2^t\4"?
? .Forward = True?
? .Wrap = wdFindStop?
? .Format = True?
? .MatchCase = False?
? .MatchWholeWord = False?
? .MatchAllWordForms = False?
? .MatchSoundsLike = False?
? .MatchWildcards = True?
? End With
? Selection.Find.Execute Replace:=wdReplaceAll
? ?
? Selection.SelectCell
? Selection.Find.ClearFormatting
? Selection.Find.Replacement.ClearFormatting
? With Selection.Find
? .Text = "(Table )([0-9][0-9])(. )(*^t)"?
? .Replacement.Text = "\2^t\4"?
? .Forward = True?
? .Wrap = wdFindStop?
? .Format = True?
? .MatchCase = False?
? .MatchWholeWord = False?
? .MatchAllWordForms = False?
? .MatchSoundsLike = False?
? .MatchWildcards = True?
? End With
? Selection.Find.Execute Replace:=wdReplaceAll
End Sub