Word) (Document.ProtectionType 屬性
會傳回指定的文件的保護類型。 可以是下列 WdProtectionType 常數之一: wdAllowOnlyComments 、 wdAllowOnlyFormFields 、 wdAllowOnlyReading 、 wdAllowOnlyRevisions 或 wdNoProtection 。
語法
expression。 ProtectionType
表達 代表 Document 物件的變數。
範例
如果使用中文件尚未受到保護,本範例會保護文件的註解。
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyComments
End If
這個範例會在使用中文件已經受到保護時,將它解除保護。
Set Doc = ActiveDocument
If Doc.ProtectionType <> wdNoProtection Then Doc.Unprotect
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。