发布网友 发布时间:2022-04-24 02:08
共4个回答
热心网友 时间:2023-09-27 10:01
如果是多个相同个数的词,比如 “知道、经验、百科” 这三个词替换为 “百度”
可以用查找替换,查找内容填 [知道经验百科]{2} 替换内容填 百度
其中2表示一个词两个字
如果是多个不同字数的词,比如 “不知道,经验,百科全书”这三个词,替换为“百度”
用查找替换没找到好方法,可以用vba,
Sub 词语替换()热心网友 时间:2023-09-27 10:01
把下面的vbA运行一下就可以了,哈哈
Sub 查找替换带输入框()
'
' 查找替换带输入框 Macro,只能以逗号分隔
' 宏在 2019-10-4 由 微软用户 创建
'
'Update by ExtendOffice 2018/10/25
Dim xFind As String
Dim xReplace As String
Dim xFindArr, xReplaceArr
Dim I As Long
Application.ScreenUpdating = False
xFind = InputBox("Enter items to be found here,seperated by comma: ", "查找替换带输入框磊磊")
xReplace = InputBox("Enter new items here, seperated by comma: ", "Kutools for Word")
xFindArr = Split(xFind, ",")
xReplaceArr = Split(xReplace, ",")
If UBound(xFindArr) <> UBound(xReplaceArr) Then
MsgBox "Find and replace characters must be equal.", vbInformation, "Kutools for Word"
Exit Sub
End If
For I = 0 To UBound(xFindArr)
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = xFindArr(I)
.Replacement.Text = xReplaceArr(I)
.Format = False
.MatchWholeWord = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
Application.ScreenUpdating = True
End Sub
'多词替换为一个词,只能以英文逗号分隔
Sub 多词替换为一个词()
Dim xFind As String
Dim xReplace As String
Dim arr
Application.ScreenUpdating = False
xFind = InputBox("输入替换的词语以英文逗号分隔", "多词替换为一个词")
xReplace = InputBox("Enter new items here输入新的目的词语, only one word: ", "多词替换为一个词")
xFindArr = Split(xFind, ",")
arr = xFindArr '旧语句arr = Array(xFind)
For I = 0 To UBound(arr)
With Selection.Find
.Text = arr(I)
.Replacement.Text = xReplace
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub
热心网友 时间:2023-09-27 10:02
这个是无法办到的。还是麻烦点一个一个替换吧。
热心网友 时间:2023-09-27 10:03
同问。单纯查找不用楼上那么复杂。在各词间加|,比如用word点查找输入,点高级搜索,点使用通配符
不知道|经验|百科全书
就可以找到了,关键怎么分别替换