⑴ 怎样批量给WORD文档加密

可以把“2读书心得”文件夹下的所有word文档批量加密和解密。密码为5822。各句可根据实际修改
Sub 加密word()
On Error Resume Next
mypath = ActiveDocument.Path & "\2读书心得"
myname = Dir(mypath & "\" & "*.doc*")
Do While myname <> ""
Set wb = Documents.Open(mypath & "\" & myname, PasswordDocument:="5822")

wb.Password = "5822"
wb.Close True
myname = Dir
Loop
End Sub
Sub 解密word()
On Error Resume Next
Dim wb As Document
mypath = ActiveDocument.Path & "\2读书心得"
myname = Dir(mypath & "\" & "*.doc*")
Do While myname <> ""
Set wb = Documents.Open(mypath & "\" & myname, PasswordDocument:="5822")
wb.ReadOnlyRecommended = False
wb.Password = ""

wb.Close True
myname = Dir
Loop
End Sub