我正在尝试使用宏执行以下操作:
打开文档后,自动搜索整个文档以查找括号{{ }}
并删除它们,包括其中的文本。
它不能很好地完成工作,只对所选文本进行操作,而不是整个文档。
Sub SelectToBracketsDelete()
With Selection.Find
.ClearFormatting
.Text = "{{"
.Forward = False
.Wrap = wdFindStop
.Execute
End With
Selection.Extend
With Selection.Find
.Text = "}}"
.Forward = True
.Execute
.Text = ""
End With
Selection.Text = ""
End Sub
答案 0 :(得分:1)
这是你在找什么?
Word 2007 - > stackoverflow
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\{\{*\}\}"
.Replacement.Text = ""
.Forward = True
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll