如何找到任何项目符号并用MS Word中的一个子弹字符替换?

时间:2016-07-01 13:13:54

标签: ms-word word-vba

我录制了一个宏,用标准子弹字符(^ 0149)替换任何子弹字符(PS:非子弹列表)。

Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
    .Text = "o^t"
    .Replacement.Text = "^0149^t"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
    .Text = ChrW(61607) & "^t"
    .Replacement.Text = "^0149^t"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

End Sub

我的问题是找不到一些子弹字符。有关示例,请参见下图。

Example 01

如何通过MS Word宏找到任何项目符号或任何字符?

1 个答案:

答案 0 :(得分:1)

未经测试,但下面的内容有帮助吗?

if asc(oldBullet) = 1 then replace by newBullet
...