ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA password removal - how many tabs? (https://www.excelbanter.com/excel-programming/403182-vba-password-removal-how-many-tabs.html)

Gleam

VBA password removal - how many tabs?
 
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



All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com