开发者

Regex but maintain font formatting?

Previously I asked for help with a word VBA macro regex.

Is th开发者_StackOverflow中文版ere a way to maintain font formatting when doing this?


Not very elegant, but is this not what you want (or do you mean that you want to replace the entire contents with a single '0')?

Sub Macro1()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^$*"
        .Replacement.Text = "0"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜