[英]Protect excel with password from vba
I want to design VBA code that protects excel document with password . 我想设计使用密码保护Excel文档的 VBA代码 。
I know its possible with excel tools and its more secure, but I want to try this and use it in other projects. 我知道可以使用excel工具实现此操作,并且它更安全,但是我想尝试一下并将其用于其他项目。
I wrote this code 我写了这段代码
vPass = InputBox("Password : ")
If StrComp(vPass, "predefinedPass") <> 0 Then Application.Quit
But when I put it in Workbook_Open
, the content of the file is still showing while while waiting for user to give password. 但是,当我将其放在Workbook_Open
,在等待用户输入密码时文件的内容仍然显示。
I don't want the content of file to be shown. 我不希望显示文件的内容。
Any ideas?? 有任何想法吗??
It is simple before firing the event set 触发事件集之前很简单
Application.Screenupdating = False
once the condition is true set screenupdating back to true 一旦条件成立,则将屏幕更新设置为true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.