P
PPL
Having positioned the cursor inside a table, The following code is intended
to work in the second column of a 2 col table and replace the word "From"
with an autotext entry called "Handoff from"
Problem is that I can not contain it to work ONLY inside the table. It works
through the entire document. Please - what am I doing wrong?
Any help would be appreciated.
TIA
Phil
'Replace From with Hand-off from in a 2 column table
Selection.Tables(1).Select
Selection.EndKey Unit:=wdLine
Selection.SelectColumn
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "From"
.Forward = True
.MatchCase = True
.Wrap = False
.Execute
End With
While Selection.Find.Found
NormalTemplate.AutoTextEntries("Handoff from").Insert
Where:=Selection. _
Range, RichText:=True
Selection.Find.ClearFormatting
With Selection.Find
.ClearFormatting
.Text = "From"
.Forward = True
.MatchCase = True
.Wrap = wdFindStop
.Execute
End With
Wend
to work in the second column of a 2 col table and replace the word "From"
with an autotext entry called "Handoff from"
Problem is that I can not contain it to work ONLY inside the table. It works
through the entire document. Please - what am I doing wrong?
Any help would be appreciated.
TIA
Phil
'Replace From with Hand-off from in a 2 column table
Selection.Tables(1).Select
Selection.EndKey Unit:=wdLine
Selection.SelectColumn
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "From"
.Forward = True
.MatchCase = True
.Wrap = False
.Execute
End With
While Selection.Find.Found
NormalTemplate.AutoTextEntries("Handoff from").Insert
Where:=Selection. _
Range, RichText:=True
Selection.Find.ClearFormatting
With Selection.Find
.ClearFormatting
.Text = "From"
.Forward = True
.MatchCase = True
.Wrap = wdFindStop
.Execute
End With
Wend