今天想要实现自动的替换掉word里面的指定的字符,于是想通过vb实现字符的相关替换。具体的代码如下:

vb 代码:



Function ReplaceText(Optional value As String)
   Dim replaceValue As String
   replaceValue = value
   Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "将要替换的内容"
        .Replacement.Text = replaceValue '替换的内容
.Forward
= True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Function

至此word里面的相关的文字被全部的替换掉了。

相关文章:

  • 2021-06-12
  • 2021-12-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案