|
Sub 替换()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim i, m As String, arr, Word As Object, F
arr = [a1].CurrentRegion
Set Word = VBA.CreateObject("word.application")
Word.Visible = 1
For i = 2 To UBound(arr)
If arr(i, 1) <> "" Then
F = ThisWorkbook.Path & "\" & arr(i, 1)
With Word.Documents.Open(F)
.Content.Find.Execute FindText:=arr(i, 2), ReplaceWith:=arr(i, 3) '查找替换
End With
Word.Documents.Close True
End If
Next
Word.Application.Quit
Set Myword = Nothing
MsgBox "替换完毕!", 48, "提示!"
End Sub
|
评分
-
1
查看全部评分
-
|