What has my macro done to my password?

  • Thread starter Thread starter Tonso
  • Start date Start date
T

Tonso

I created a macro, and used the Activesheet.Unprotect Password:="trip"
to protect it. But, I left out the : after "Password". When i tried to
run the macro i got a debug message. Now, "trip" will not unprotect my
sheet, and i have no idea how to get it unprotected. Can anypone
figure out what the password has been changed to?

Thanks,
Tonso
 
I created a macro, and used the Activesheet.Unprotect Password:="trip"
to protect it. But, I left out the : after "Password". When i tried to
run the macro i got a debug message. Now, "trip" will not unprotect my
sheet, and i have no idea how to get it unprotected. Can anypone
figure out what the password has been changed to?

Thanks,
Tonso

I should add that i also left out the : after Password when I wrote
the Actvicesheet.Protect=:"trip"
Tonso
 
I bet you used:

Activesheet.Protect Password = "trip"
(not .unprotect)

You could either use code:
Activesheet.Unprotect Password = "trip"

or manually unprotect it using
FALSE
(all upper case)

Password = "trip"
is essentially a boolean comparison.

And since Password hasn't be declared, excel sees it as empty. So that boolean
comparison evaluates to FALSE.

If you add
Option Explicit
to the top of your module, then your code wouldn't have compiled--you would have
to declare all your variable explicitly. Excel/VBA would have seen Password as
an undeclared variable and you would have been safe(r).
 
I bet you used:

Activesheet.Protect Password = "trip"
(not .unprotect)

You could either use code:
Activesheet.Unprotect Password = "trip"

or manually unprotect it using
FALSE
(all upper case)

Password = "trip"
is essentially a boolean comparison.

And since Password hasn't be declared, excel sees it as empty.  So that boolean
comparison evaluates to FALSE.

If you add
Option Explicit
to the top of your module, then your code wouldn't have compiled--you would have
to declare all your variable explicitly.  Excel/VBA would have seen Password as
an undeclared variable and you would have been safe(r).

Dave,
You are right! Thanks immensely!
Tonso
 
Back
Top