Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
auto-protect a sheet upon workbook close
Hi, I am trying to auto-protect a sheet upon workbook close (so people a
certain person doesnt forget to reapply protection when closing out of a file that he maintains). The below macro works fine, but disables ALL options for the user. Sub ApplySecurity() Worksheets("Master").Protect Password:="1225" End Sub Id like to allow the user to a few basic things, such as select locked/unlocked cells, use auto filter, and edit objects. Sub ApplySecurity() Worksheets("Master").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ True, AllowFiltering:=True Worksheets("Master").Protect End Sub How do I add the password in there? Ive tried a couple things; I get only errors. In ThisWorkbook, Ive got: Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ApplySecurity End Sub Private Sub Workbook_Open() Call ApplySecurity End Sub Thanks, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
auto-protect a sheet upon workbook close
Hi,
Like this Sub ApplySecurity() Worksheets("Master").Protect Password:="1234", DrawingObjects:=False, _ Contents:=True, Scenarios:=True, AllowFiltering:=True End Sub "ryguy7272" wrote: Hi, I am trying to auto-protect a sheet upon workbook close (so people a certain person doesnt forget to reapply protection when closing out of a file that he maintains). The below macro works fine, but disables ALL options for the user. Sub ApplySecurity() Worksheets("Master").Protect Password:="1225" End Sub Id like to allow the user to a few basic things, such as select locked/unlocked cells, use auto filter, and edit objects. Sub ApplySecurity() Worksheets("Master").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ True, AllowFiltering:=True Worksheets("Master").Protect End Sub How do I add the password in there? Ive tried a couple things; I get only errors. In ThisWorkbook, Ive got: Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ApplySecurity End Sub Private Sub Workbook_Open() Call ApplySecurity End Sub Thanks, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
auto-protect a sheet upon workbook close
Hi,
I should have added that your calls to this sub will work fine Mike "Mike H" wrote: Hi, Like this Sub ApplySecurity() Worksheets("Master").Protect Password:="1234", DrawingObjects:=False, _ Contents:=True, Scenarios:=True, AllowFiltering:=True End Sub "ryguy7272" wrote: Hi, I am trying to auto-protect a sheet upon workbook close (so people a certain person doesnt forget to reapply protection when closing out of a file that he maintains). The below macro works fine, but disables ALL options for the user. Sub ApplySecurity() Worksheets("Master").Protect Password:="1225" End Sub Id like to allow the user to a few basic things, such as select locked/unlocked cells, use auto filter, and edit objects. Sub ApplySecurity() Worksheets("Master").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ True, AllowFiltering:=True Worksheets("Master").Protect End Sub How do I add the password in there? Ive tried a couple things; I get only errors. In ThisWorkbook, Ive got: Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ApplySecurity End Sub Private Sub Workbook_Open() Call ApplySecurity End Sub Thanks, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
auto-protect a sheet upon workbook close
So weird; thought I tried that. I probably forgot the comma after the
password. Thanks MikeH!!! Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Mike H" wrote: Hi, Like this Sub ApplySecurity() Worksheets("Master").Protect Password:="1234", DrawingObjects:=False, _ Contents:=True, Scenarios:=True, AllowFiltering:=True End Sub "ryguy7272" wrote: Hi, I am trying to auto-protect a sheet upon workbook close (so people a certain person doesnt forget to reapply protection when closing out of a file that he maintains). The below macro works fine, but disables ALL options for the user. Sub ApplySecurity() Worksheets("Master").Protect Password:="1225" End Sub Id like to allow the user to a few basic things, such as select locked/unlocked cells, use auto filter, and edit objects. Sub ApplySecurity() Worksheets("Master").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ True, AllowFiltering:=True Worksheets("Master").Protect End Sub How do I add the password in there? Ive tried a couple things; I get only errors. In ThisWorkbook, Ive got: Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ApplySecurity End Sub Private Sub Workbook_Open() Call ApplySecurity End Sub Thanks, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
auto-protect a sheet upon workbook close
Your welcome and thanks for the feedback
"ryguy7272" wrote: So weird; thought I tried that. I probably forgot the comma after the password. Thanks MikeH!!! Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Mike H" wrote: Hi, Like this Sub ApplySecurity() Worksheets("Master").Protect Password:="1234", DrawingObjects:=False, _ Contents:=True, Scenarios:=True, AllowFiltering:=True End Sub "ryguy7272" wrote: Hi, I am trying to auto-protect a sheet upon workbook close (so people a certain person doesnt forget to reapply protection when closing out of a file that he maintains). The below macro works fine, but disables ALL options for the user. Sub ApplySecurity() Worksheets("Master").Protect Password:="1225" End Sub Id like to allow the user to a few basic things, such as select locked/unlocked cells, use auto filter, and edit objects. Sub ApplySecurity() Worksheets("Master").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ True, AllowFiltering:=True Worksheets("Master").Protect End Sub How do I add the password in there? Ive tried a couple things; I get only errors. In ThisWorkbook, Ive got: Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ApplySecurity End Sub Private Sub Workbook_Open() Call ApplySecurity End Sub Thanks, Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
auto close workbook | Excel Discussion (Misc queries) | |||
Auto-Protect Sheet on Open and on Close | Excel Programming | |||
how to setup a excel sheet to be protect after save and close file | Excel Discussion (Misc queries) | |||
Auto Excel workbook close: save= false during an auto subroutine | Excel Programming | |||
Auto Close A Workbook...With Two Twists! | Excel Programming |