VBA password removal - how many tabs?

G

Gleam

I have found ths code listed below which gives a method of using sendkeys to
unlock a password protected project. I contains the line
..SendKeys "{TAB}", True ' Tab to locked project
If one has more than two workbooks open how can one be sure that enough tabs
have been performed?
Is there a way of reading the project name so that the code can compare it
with the workbook name?

Sub UnlockVBAProject()
' XL2000, Win2K
With Application
.SendKeys "%{F11}", True ' VBE
.SendKeys "^r", True ' Set focus to Explorer
.SendKeys "{TAB}", True ' Tab to locked project
.SendKeys "~", True ' Enter
.SendKeys "password" ' project password
.SendKeys "~", True ' Enter
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top