我需要用另一个文本替换一些开始文本,并在末尾添加另一个文本。这是一个开始的例子:
- This is a phrase that match
Another - Phrase
Yes another - one
- This also match
我想要的结果是:
$This is a phrase that match%
Another - Phrase
Yes another - one
$This also match%
所以替换"- "与"$";(仅当是句子的前两个字符),并在行尾添加"%">
我有搜索和替换功能的工作,但我不知道如何添加行结束:
With Selection.Find
.ClearFormatting
.Text = "- "
.Replacement.Text = "$"
.Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
End With
我看到有一个InsetAfter方法,但它创建了一个新的行,或者我有错误的实现。建议吗?由于
你甚至不需要一个宏!您只需要一个通配符查找/替换,其中:
Find = ^13- ([!^13]@)^13
Replace = ^p$1%^p