Reputation: 161
I start the Workbook_Open event with this line of code
Table1.Protect Password = "Secret", UserInterFaceOnly:=True
However, when I try to unlock it with
Table1.Unprotect ("Secret")
it does not work.
The Password Cracker says, that a working password would be "AAAAAAAABABF"
How do I actually set "Secret" as the password.
Upvotes: 3
Views: 1502
Reputation: 17637
TL;DR Read the article that Rory wrote (in his answer below)
Firstly, your protect code is wrong (missing a colon :
):
Table1.Protect Password = "Secret", UserInterFaceOnly:=True
This is assigning Password
which will be treated as an undeclared variable (did you forget to use Option Explicit
?)
It should be this:
Table1.Protect Password:= "Secret", UserInterFaceOnly:=True
The Password Cracker says, that a working password would be "AAAAAAAABABF"
This is because these kinds of passwords in Excel are not secure (this is well documented). Passwords of this nature in Excel rely on more of a numerical value where each character is assigned a numeric value... so:
d = 4
a = 1
(a + a + a + a) = d
and so in this case using d
or aaaa
would work as your password. (This is a crude example of how it works, not the exact methods).
Upvotes: 3
Reputation: 34045
It's a common mistake (so common I wrote this: http://excelmatters.com/2013/10/03/whats-in-a-colon/).
Your Protect
code is missing a colon:
Table1.Protect Password:="Secret", UserInterFaceOnly:=True
You were actually protecting the workbook with the password False, since that's the result of the expression:
Password = "Secret"
Upvotes: 5