其他分享
首页 > 其他分享> > 20190318wdVBA_替换下划线

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

  

标签:Selection,False,下划线,ClearFormatting,替换,20190318wdVBA,True,Find,Replacement
来源: https://www.cnblogs.com/nextseven/p/10552099.html