如何将密码传递给受保护的VBA项目?
要检查项目11是否受到保护,我们可以使用以下代码:
Application.VBE.VBProjects(11).Protection返回1(如果是yes )和0(如果是no ),但是除了基于SendKeys()的方法之外,我没有发现任何关于传递密码的信息。
发布于 2014-12-18 14:53:32
http://www.pcreview.co.uk/forums/unprotecting-vba-project-t989191.html
'Const conPW as String = "MyPassword"
'Open VBE
Call SendKeys("%{F11}", True)
'Open Project Explorer
Call SendKeys("%(V)P", True)
'PageUp 5 times to be sure "VBAProject" is selected
Call SendKeys("{PGUP 5}", True)
'Hit Enter to give prompt, enter PW and Enter again.
Call SendKeys("{ENTER}" & conPW & "{ENTER}", True)..。
https://stackoverflow.com/questions/24262154
复制相似问题