20190318wdVBA_替换下划线

Sub 替换下划线()
    Selection.HomeKey wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Font.Underline = wdUnderlineThick
    Selection.Find.Replacement.ClearFormatting
    'Selection.Find.Replacement.Font.Underline = wdUnderlineThick
    With Selection.Find
        .Text = "[!^13^l]"
        .Replacement.Text = "__"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    

    
    Selection.HomeKey wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Font.Underline = wdUnderlineSingle
    Selection.Find.Replacement.ClearFormatting
    'Selection.Find.Replacement.Font.Underline = wdUnderlineThick
    With Selection.Find
        .Text = "[!^13^l]"
        .Replacement.Text = "__"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

  

posted @ 2019-03-18 14:44  wangway  阅读(441)  评论(0编辑  收藏  举报