Sub 替换词语()
Dim doc As Document
Dim findText As String
Dim replaceText As String
' 设置第一个要查找和替换的文本
findText = "机构管理"
replaceText = "部门管理"
' 获取当前活动文档
Set doc = ActiveDocument
' 开始第一个查找和替换
With doc.Content.Find
.ClearFormatting
.Text = findText
.Replacement.Text = replaceText
.Forward = True
.Wrap = wdFindContinue ' 在整个文档中查找
.Execute Replace:=wdReplaceAll ' 替换所有匹配项
End With
' 设置第一个要查找和替换的文本
findText = "机构"
replaceText = "部门"
' 获取当前活动文档
Set doc = ActiveDocument
' 开始第一个查找和替换
With doc.Content.Find
.ClearFormatting
.Text = findText
.Replacement.Text = replaceText
.Forward = True
.Wrap = wdFindContinue ' 在整个文档中查找
.Execute Replace:=wdReplaceAll ' 替换所有匹配项
End With
' 设置第二个要查找和替换的文本
findText = "Organize"
replaceText = "Department"
' 开始第二个查找和替换
With doc.Content.Find
.ClearFormatting
.Text = findText
.Replacement.Text = replaceText
.Forward = True
.Wrap = wdFindContinue ' 在整个文档中查找
.Execute Replace:=wdReplaceAll ' 替换所有匹配项
End With
End Sub