2014-06-17 69 views
0

如何將密碼傳遞給受保護的VBA項目?
要檢查的項目數11是受保護的,我們可以使用下面的代碼:將項目密碼傳遞給鎖定的VBA項目

Application.VBE.VBProjects(11).Protection 

其返回1,如果yes和0,如果no,但我發現沒有關於通過密碼除了SendKeys()基於方法的信息

+0

'SendKeys'是唯一W¯¯唉。 – ja72

回答

0

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) 

...

相關問題