Word) (Document.PasswordEncryptionAlgorithm 屬性

會傳回指出 Microsoft Word 用於以密碼加密文件的演算法的 字串 。 唯讀。

語法

expressionPasswordEncryptionAlgorithm

表達 代表 Document 物件的變數。

註解

若要指定 Word 用於以密碼加密文件的演算法使用 SetPasswordEncryptionOptions 方法。

範例

如果使用中的密碼加密演算法是 "OfficeXor" (此為 Word 97 for Windows 之前的 Word 版本所用的密碼演算法),本範例會設定密碼加密選項。

Sub PasswordSettings() 
 With ActiveDocument 
 If .PasswordEncryptionAlgorithm = "OfficeXor" Then 
 .SetPasswordEncryptionOptions _ 
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _ 
 PasswordEncryptionAlgorithm:="RC4", _ 
 PasswordEncryptionKeyLength:=56, _ 
 PasswordEncryptionFileProperties:=True 
 End If 
 End With 
End Sub

另請參閱

Document 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應