Sub UnProtectAllDocFiles()
On Error Resume Next
Const strRootPath = "D:\我的文件"          ' 存放文档的目录
Const strPassword = ""           ' 密码
Const strNewPassword = ""             '新密码
Dim oDoc As Document
Dim fso, oFolder, oFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(strRootPath)
For Each oFile In oFolder.Files
Set oDoc = Documents.Open(FileName:=oFile.Path, PasswordDocument:=strPassword)
oDoc.Saved = False
oDoc.SaveAs FileName:=oFile.Path, Password:=strNewPassword, WritePassword:=""
oDoc.Close
Next
MsgBox "完成!"
End Sub