Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks so much, Jim. This really helps. You experts are making me look
good!!! "Jim Thomlinson" wrote: You can not add a line break in VBA without adding a line break character which is the underscore. I Like to line up my parameters for easy reading so I do it something like this. You have one but you have 2 line breaks. That might just be how you post got formatted though. Other than that you need a coma between each parameter and you are missing one after password... ActiveSheet.Unprotect Password:="mypassword" Application.EnableEvents = False Application.EnableEvents = True ActiveSheet.Protect Password:="mypassword", _ DrawingObjects:=True, _ Contents:=True, Scenarios:=True, _ AllowFormattingColumns:=True -- HTH... Jim Thomlinson "Dana M" wrote: Using info obtained from other postings in this chat, I am attempting to add a password to my sheet protection. I have macros that add and delete rows in the worksheet. I have 'Unprotect' code at the beginning of the macros and 'Protect" at the end, which I modified slightly in this way: ActiveSheet.Unprotect Password:="mypassword" Application.EnableEvents = False Application.EnableEvents = True ActiveSheet.Protect Password:="mypassword" DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingColumns:=True I haven't even gotten to the point of trying to step through the macro, but the 'unprotect' statement (is that what you call that bit of code, statement?) remained in black text, but the 'protect' statement immediately turned red with an error message, "Compile error - expected end of statement" right around the DrawingObjects:=True part. This all worked correctly before adding the password, and before adding the Password:="mypassword" to the code. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password protection in macro ( Anybody can view my password in VB | Excel Discussion (Misc queries) | |||
Excel Data Protection- AKA: Sheet/Macro Password Protection | Setting up and Configuration of Excel | |||
Password protection... | Excel Discussion (Misc queries) | |||
how to hide a list of macros in excel 2000 without password protection | Setting up and Configuration of Excel | |||
how to hide a list of macros without password protection | Excel Worksheet Functions |