返回在对指定的工作簿编写密码时,Microsoft Excel 使用的算法的关键字长度。Long 类型,只读。
expression.PasswordEncryptionKeyLength
expression 必需。该表达式返回“应用于”列表中的对象之一。
使用 SetPasswordEncryptionOptions 方法可指定 Excel 是否对具有密码保护的指定工作簿的文件属性进行加密。
如果密码加密的关键字长度小于 56,那么本示例设置指定工作簿的密码加密选项。
Sub SetPasswordOptions()
With ActiveWorkbook
If .PasswordEncryptionKeyLength < 56 Then
.SetPasswordEncryptionOptions _
PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
PasswordEncryptionAlgorithm:="RC4", _
PasswordEncryptionKeyLength:=56, _
PasswordEncryptionFileProperties:=True
End If
End With
End Sub