oaksoft

批量修改WORD文档密码

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

 

发表于 2013-01-03 08:18  Oaksoft  阅读(325)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-10-25
  • 2021-09-01
  • 2021-12-02
  • 2021-11-07
猜你喜欢
  • 2022-01-16
  • 2021-09-14
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-12-24
  • 2021-08-15
相关资源
相似解决方案