Sub 批量删除多个文档中的全部超链接()

Application.Visible = False

Dim fpath As String, fname As String, arr, i As Integer, doc As Document, hik As Hyperlink

fpath = "e:\test\"

fname = Dir(fpath & "x.doc?")

Do While fname <> ""

Set doc = Documents.Open(fpath & fname)

With doc

For Each hik In .Hyperlinks

hlk.Delete

Next hik

.Save

.Close

End With

fname = Dir

Loop

MsgBox "all link deleted!"

Application.Visible = True

End Sub

Sub 批量删除多个文档中的指定词语()

Application.Visible = False

Dim fpath As String, fname As String, arr, i As Integer, doc As Document

fpath = "e:\test\"

fname = "test1,test2,test3"

arr = Split(fname, ",")

For i = LBound(arr) To UBound(arr)

Set doc = Documents.Open(fpath & arr(i) & ".docx")

With doc

With Selection.Find

.ClearFormatting

.Text = "万琼"

.Replacement.ClearFormatting

.Replacement.Text = "万群"

.Execute Replace:=wdReplaceAll

End With

.Save

.Close

End With

Next i

Application.Visible = True

End Sub