我有一个Word 2010文档,其中一些加减号用数字包围。 我想格式化加号减号,以便每个加号减号前后都有空白。
我的代码能够找到该符号。 不幸的是,ReplaceString留下了一个白框,而不是加减号。
Dim ReplaceString As String
ReplaceString = " " & ChrW(-3919) & " "
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = ChrW(-3919) 'plus/minus symbol
.Forward = True
.Format = True
.MatchCase = False
.Replacement.Text = ReplaceString
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Replacement.ClearFormatting
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
答案 0 :(得分:0)
尝试:
With ActiveDocument.Range.Find
.ClearFormatting
.Text = ChrW(-3919) 'plus/minus symbol
With .Replacement
.ClearFormatting
.Highlight = True
.Text = " ^& "
End With
.Format = True
.Forward = True
.Wrap = wdFindContinue
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With