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