方式一:
Sub protHeader()
'取消保护
If Not ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Unprotect (“123456”)
End If
Dim currentSection As Section
'如果只有1节就在最前面插入一个连续分节符
If ActiveDocument.Sections.Count = 1 Then
Selection.HomeKey Unit:=wdStory
Selection.InsertBreak Type:=wdSectionBreakContinuous
End If
'将所有节设置为不选中
For Each currentSection In ActiveDocument.Sections
currentSection.ProtectedForForms = False
Next
'保护起来
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=WdProtectionType.wdAllowOnlyFormFields, Password:=”123456″, NoReset:=True, EnforceStyleLock:=False
End If
End Sub
方式二:
Sub protWithoutMain()
'取消保护
If Not ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Unprotect (“123456789”)
End If
'选中整篇文章
Selection.WholeStory
'将整篇文章的例外项设置为每个人
Selection.Editors.Add wdEditorEveryone
'保护起来
ActiveDocument.Protect Password:=”123456″, NoReset:=True, Type:= _
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False
'取消全选,将光标移至文章开头
Selection.HomeKey Unit:=wdStory
End Sub
总结:
方式一不能添加批注、不能添加/修改编号、可以删除页眉页脚
方式二可以添加批注、可以添加/修改编号、不可以删除页眉页脚
在可进行的操作方面还有其他一些细微差别,各有所长。
Word文档保护与解锁技巧

本文介绍了两种在Word中保护和解锁文档的方法。方式一通过禁用除表单字段外的所有编辑,允许添加批注和编号,但不允许删除页眉页脚。方式二则允许阅读模式下的全文访问,禁止删除页眉页脚,但增强批注和编号的灵活性。两种方式各有优缺点,适用于不同场景。
1万+

被折叠的 条评论
为什么被折叠?



