SetPasswordEncryptionOptions Method

Microsoft PowerPoint Visual Basic

Show All

SetPasswordEncryptionOptions Method

       

Sets the options Microsoft PowerPoint uses for encrypting presentations with passwords.

expression.SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionFileProperties, PasswordEncryptionKeyLength, PasswordEncryptionAlgorithm)

expression   Required. An expression that returns one of the objects in the Applies To list.

PasswordEncryptionProvider  Required String. The name of the encryption provider.

PasswordEncryptionAlgorithm  Required String. The name of the encryption algorithm. PowerPoint supports stream-encrypted algorithms.

PasswordEncryptionKeyLength  Required Long. The encryption key length. Must be a multiple of 8, starting at 40.

PasswordEncryptionFileProperties  Required MsoTriState. MsoTrue for PowerPoint to encrypt file properties.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this method.
msoFalse
msoTriStateMixed Not used with this method.
msoTriStateToggle Not used with this method.
msoTrue

Example

This example sets the password encryption options if the file properties are not encrypted for password-protected documents.

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