|
- Sub word多个文档批量添加打开密码尚待完善()
- Rem 需要选择需要添加密码的多个文件
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Application.FileDialog(msoFileDialogFilePicker)
- .Filters.Clear
- .Filters.Add "Word Files", "*.do*"
- If .Show = -1 Then
- For Each oItem In .SelectedItems
- Documents.Open (oItem)
- With ActiveDocument
- '此处放置代码内容
- 'i = i + 1
- .SaveAs FileName:=ActiveDocument.FullName, Password:="123" '打开密码
- '.Protect Type:=wdAllowOnlyFormFields, Password:="123" '文档保护限制编辑,但不是打开密码
- .Close True
- 'MsgBox ActiveDocument.FullName
- ' .Save
- '.Close
- End With
- Next '继续下一个文件
- Else
- Exit Sub
- End If
- End With
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- 'MsgBox i
- MsgBox "操作完毕!"
- End Sub
复制代码 我写代码试了一下,但此代码失效,不能顺利给多个word文档添加“123”的密码,请指教^_^
|
|