Password/Protect related procedures in class Presentation (PowerPoint VBA)

This page presents procedures from class Presentation related to the theme Password/Protect: Password, PasswordEncryptionAlgorithm, PasswordEncryptionFileProperties, PasswordEncryptionKeyLength, PasswordEncryptionProvider, SetPasswordEncryptionOptions and WritePassword

Password

Returns or sets the password that must be supplied to open the specified presentation.

ActivePresentation.Password = "*******"

PasswordEncryptionAlgorithm

Returns the algorithm Microsoft PowerPoint uses for encrypting documents with passwords.

Use the SetPasswordEncryptionOptions method to specify the algorithm PowerPoint uses for encrypting documents with passwords.

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

PasswordEncryptionFileProperties

Returns whether Microsoft PowerPoint encrypts file properties for password-protected documents.

Use the SetPasswordEncryptionOptions method to specify the algorithm PowerPoint uses for encrypting documents with passwords. The value of the PasswordEncryptionFileProperties property can be one of these MsoTriState constants.

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

PasswordEncryptionKeyLength

Returns the key length of the algorithm Microsoft PowerPoint uses when it encrypts documents with passwords.

Use the SetPasswordEncryptionOptions method to specify the algorithm PowerPoint uses for encrypting documents with passwords.

Dim lngPasswordEncryptionKeyLength As Long
lngPasswordEncryptionKeyLength = ActivePresentation.PasswordEncryptionKeyLength

PasswordEncryptionProvider

Returns the name of the algorithm encryption provider that Microsoft PowerPoint uses when it encrypts documents with passwords.

Use the SetPasswordEncryptionOptions method to specify the algorithm PowerPoint uses for encrypting documents with passwords.

Dim strPasswordEncryptionProvider As String
strPasswordEncryptionProvider = ActivePresentation.PasswordEncryptionProvider

SetPasswordEncryptionOptions

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

The PasswordEncryptionFileProperties parameter value can be one of these MsoTriState constants.

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

Dim strPasswordEncryptionProvider As String: strPasswordEncryptionProvider = 
Dim strPasswordEncryptionAlgorithm As String: strPasswordEncryptionAlgorithm = 
Dim lngPasswordEncryptionKeyLength As Long: lngPasswordEncryptionKeyLength = 
ActivePresentation.SetPasswordEncryptionOptions PasswordEncryptionProvider:=strPasswordEncryptionProvider, PasswordEncryptionAlgorithm:=strPasswordEncryptionAlgorithm, PasswordEncryptionKeyLength:=lngPasswordEncryptionKeyLength, PasswordEncryptionFileProperties:=True

Arguments

The following arguments are required:

PasswordEncryptionProvider (String) - The name of the encryption provider.

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

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

PasswordEncryptionFileProperties (Boolean) - msoTrue for PowerPoint to encrypt file properties.

WritePassword

Sets or returns the password for saving changes to the specified document.

ActivePresentation.WritePassword =