Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to Protect Worksheet
I accidentally used the following code in some VBA to protect my worksheet:
ActiveSheet.Protect Password = "grencr" (I excluded the colon) I should have used: ActiveSheet.Unprotect Password:="grencr". The code worked and my worksheet is now protected, but I'm not sure what the password is. It is no longer grencr. Any idea what my password was set to since I didn't include the : in the code? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to Protect Worksheet
Try FALSE (all caps).
If that doesn't work, you could break the password... (Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html) Alex wrote: I accidentally used the following code in some VBA to protect my worksheet: ActiveSheet.Protect Password = "grencr" (I excluded the colon) I should have used: ActiveSheet.Unprotect Password:="grencr". The code worked and my worksheet is now protected, but I'm not sure what the password is. It is no longer grencr. Any idea what my password was set to since I didn't include the : in the code? Thanks -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to Protect Worksheet
YES!!!! Thanks so much Dave - I've trying everything.
"Dave Peterson" wrote: Try FALSE (all caps). If that doesn't work, you could break the password... (Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html) Alex wrote: I accidentally used the following code in some VBA to protect my worksheet: ActiveSheet.Protect Password = "grencr" (I excluded the colon) I should have used: ActiveSheet.Unprotect Password:="grencr". The code worked and my worksheet is now protected, but I'm not sure what the password is. It is no longer grencr. Any idea what my password was set to since I didn't include the : in the code? Thanks -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to Protect Worksheet
You may have been saved a little trouble by telling excel that you want to only
use variables that you declare. If you had: Option Explicit At the top of your module, then every variable would have to have a: dim xxxx as yyyyy statement. And Password may have been flagged as an undeclared variable. It may seem like extra work to have to declare all your variables, but it can stop the kind of error you had and even these hard to see ones: Row1 = Rowl + 1 (one is row-one and one is row-ell) And you get all the nice intellisense on top of this. dim wks as worksheet type wks. As soon as you hit that dot (.), you'll get a list off all the things that can come next. Alex wrote: YES!!!! Thanks so much Dave - I've trying everything. "Dave Peterson" wrote: Try FALSE (all caps). If that doesn't work, you could break the password... (Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html) Alex wrote: I accidentally used the following code in some VBA to protect my worksheet: ActiveSheet.Protect Password = "grencr" (I excluded the colon) I should have used: ActiveSheet.Unprotect Password:="grencr". The code worked and my worksheet is now protected, but I'm not sure what the password is. It is no longer grencr. Any idea what my password was set to since I didn't include the : in the code? Thanks -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can protect worksheet then workbook but not Protect and Share in code | Excel Programming | |||
protect worksheet | Excel Discussion (Misc queries) | |||
worksheet protect | Excel Worksheet Functions | |||
How to protect a worksheet from being copied to another worksheet | Excel Discussion (Misc queries) | |||
Protect worksheet | Excel Programming |