Document.SetPasswordEncryptionOptions (Word)
Sets the options Microsoft Word uses for encrypting documents with passwords.
For enhanced security, do not use Weak Encryption (XOR) (also called "OfficeXor") or "Office97/2000 Compatible" (also called "OfficeStandard") algorithms.
SetPasswordEncryptionOptions (PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)
Sub PasswordSettings()
With ActiveDocument
If .PasswordEncryptionAlgorithm = "OfficeXor" Or _
.PasswordEncryptionAlgorithm = "OfficeStandard" Then
.SetPasswordEncryptionOptions _
PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
PasswordEncryptionAlgorithm:="RC4", _
PasswordEncryptionKeyLength:=56, _
PasswordEncryptionFileProperties:=True
End If
End With
End Sub
Arguments
The following arguments are required:
PasswordEncryptionProvider (String) - The name of the encryption provider.
PasswordEncryptionAlgorithm (String) - The name of the encryption algorithm. Word supports stream-encrypted algorithms.
PasswordEncryptionKeyLength (Long) - The encryption key length. Must be a multiple of 8, starting at 40.
Optional arguments
The following argument is optional
PasswordEncryptionFileProperties (Boolean) - True for Word to encrypt file properties. Default is True.