返回列表 发帖

[问题求助] 以下加密的高级选项在VBS中怎么改?

以下是VBA加密的高级选项,放在VBS中怎么改?谢谢
wk.SetPasswordEncryptionOptions PasswordEncryptionProvider:= _
        "Microsoft Base Cryptographic Provider v1.0", PasswordEncryptionAlgorithm:= _
        "RC4", PasswordEncryptionKeyLength:=40, PasswordEncryptionFileProperties:=True

回复 2# yu2n


    成功,很好!谢谢老师!现在这样加密更安全了!!

TOP

打开VBA,按F1打开帮助,查找 SetPasswordEncryptionOptions :
Excel 2007 开发人员参考 > Excel 对象模型参考 > Workbook 对象 > 方法
Excel 开发人员参考
Workbook.SetPasswordEncryptionOptions 方法
使用密码来设置对工作簿进行加密的选项。
语法
表达式.SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)
表达式   一个代表 Workbook 对象的变量。
参数
名称 必选/可选 数据类型 描述
PasswordEncryptionProvider 可选 Variant 区分大小写的加密服务提供商的字符串。
PasswordEncryptionAlgorithm 可选 Variant 区分大小写的算法简称的字符串(例如“RC4”)。
PasswordEncryptionKeyLength 可选 Variant 加密密钥的长度,为 8 的倍数(40 或更大)。
PasswordEncryptionFileProperties 可选 Variant 如果为 True(默认值),则加密文件属性。
说明
PasswordEncryptionProvider、PasswordEncryptionAlgorithm 和 PasswordEncryptionKeyLength 参数不相互独立。选定的加密提供商限制了可以选择的算法和密钥长度的设置。
对于 PasswordEncryptionKeyLength 参数来说,没有固定的对密钥长度范围的限制。该范围是由“加密服务提供商”确定的,同时还确定加密算法。
示例
本示例设置活动工作簿的密码加密选项。
Visual Basic for Applications
Sub SetPasswordOptions()
    ActiveWorkbook.SetPasswordEncryptionOptions _
        PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
        PasswordEncryptionAlgorithm:="RC4", _
        PasswordEncryptionKeyLength:=56, _
        PasswordEncryptionFileProperties:=True
End Sub
© 2006 Microsoft Corporation。保留所有权利。
请参阅
Workbook 对象
Workbook 对象成员COPY


<参数名称> := <参数内容>
将<参数内容>填入<参数名称>对应位置即可,如果没有对应的<参数名称>,则留空:
wk.SetPasswordEncryptionOptions "Microsoft Base Cryptographic Provider v1.0", "RC4", 40, TrueCOPY
1

评分人数

    • ww0000: 感谢老师帮助!技术 + 1
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

返回列表