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

  

上一篇:[LeetCode] Find And Replace in String 在字符串中查找和替换


下一篇:<LeetCode|数据库>175.组合两个表