Created
June 28, 2018 14:01
-
-
Save amorist/09abb3f5e8a18fb9e53bf34b3bb77e7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub UnProtectAllDocFiles() | |
On Error Resume Next | |
Const strRootPath = "F:\doc" ' 存放文档的目录 | |
Const strPassword = "0216" ' 密码 | |
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:="", WritePassword:="" | |
oDoc.Close | |
Next | |
MsgBox "完成!" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment