vb如何对excel文件加密码?

来源:百度知道 编辑:UC知道 时间:2024/06/19 16:37:57
在保存的时候加密码,在打开的时候也可以按这个密码打开excel,谢谢!

ActiveWorkbook.SetPasswordEncryptionOptions PasswordEncryptionProvider:="", _
PasswordEncryptionAlgorithm:="OfficeStandard", PasswordEncryptionKeyLength:=40 _
, PasswordEncryptionFileProperties:=False
ActiveWorkbook.Password = "123"

读取文件数据流,写入一段你自己定的东西,乱七八糟的,等到要读时再去了这些东西就正常了,如果要密码就按算法加密密码保存入去,同样的道理

00