Name
workbook
.SetPasswordEncryptionOptions(PasswordEncryptionProvider
, PasswordEncryptionAlgorithm
, PasswordEncryptionKeyLength
, PasswordEncryptionFileProperties
)
Synopsis
Sets the workbook’s encryption properties.
Argument |
Settings |
---|---|
|
A string containing the full name of the encryption provider, such as |
|
A string containing the type of encryption to use. Use |
|
The length of the encryption key. Must be a valid value for the encryption provider. |
|
Set to True to encrypt the workbook’s file properties, False to leave them unencrypted. |
The following code sets strong encryption on a workbook:
Set wb = ThisWorkbook wb.SetPasswordEncryptionOptions "Microsoft Strong Cryptographic Provider", _ "RC4", 128, True
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.