Hi Guys,
VB Project of the database I created is password protected. This means that I have to unlock it in order to programitically add code to e.g. form. I found somewhere such a code that uses SendKeys method to provide the password so new code can be added. The "unlock" code is as follows:
Code:
Dim Password as string
Password = "xxxx"
SendKeys "%{F11}", True
SendKeys "%TE+{TAB}{RIGHT}%V{+}{TAB}", True
SendKeys Password, True
SendKeys "~", True
SendKeys "{ESC}", True
SendKeys "%{F11}"
This code does the job well when run from e.g. form's button. Unfortunately I have to run it from form_open event. In such case this code doesn't work. It should send "ALT+F11" to display vba project window, then should send "%TE+{TAB}{RIGHT}%V{+}{TAB}" to display password prompt, send password and send enter key. It doesn't work, though, when triggered from form_open event. Why doesn't it work? How can I work around it?
PS. I know SendKeys is very unreliable method but there's no other way. This topic is not to post how unreliable it is and "why do I use it" questions...
Regards,
Robert