Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Auto-Protect Sheet on Open and on Close

I have the following code in ThisWorkbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub

Private Sub Workbook_Open()
Call ApplySecurity
End Sub

I have this in a Module:
Sub ApplySecurity()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
End Sub

I just noticed that whether macros are enabled or disabled, a user can just
click Tools Protection Unprotect and make any changes they want; Excel
doesnt even ask me for a password. Did I miss something here?

Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,276
Default Auto-Protect Sheet on Open and on Close

Hi,
if you want your sheet to be protected use

Worksheets("your worksheet name").Protect Password:="your password"




"ryguy7272" wrote:

I have the following code in ThisWorkbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub

Private Sub Workbook_Open()
Call ApplySecurity
End Sub

I have this in a Module:
Sub ApplySecurity()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
End Sub

I just noticed that whether macros are enabled or disabled, a user can just
click Tools Protection Unprotect and make any changes they want; Excel
doesnt even ask me for a password. Did I miss something here?

Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,722
Default Auto-Protect Sheet on Open and on Close

As Eduardo mentions, you can setup a password. However, please note that it
is VERY easy to disable macros, or to simply use another macro (available
online) to crack a sheet protection password in 1 to 2 minutes. So, at best,
a sheet protection password provides a hindrance.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"ryguy7272" wrote:

I have the following code in ThisWorkbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub

Private Sub Workbook_Open()
Call ApplySecurity
End Sub

I have this in a Module:
Sub ApplySecurity()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
End Sub

I just noticed that whether macros are enabled or disabled, a user can just
click Tools Protection Unprotect and make any changes they want; Excel
doesnt even ask me for a password. Did I miss something here?

Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Auto-Protect Sheet on Open and on Close

Yes, I am aware of the shortcomings.
Thanks, both of you.
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Luke M" wrote:

As Eduardo mentions, you can setup a password. However, please note that it
is VERY easy to disable macros, or to simply use another macro (available
online) to crack a sheet protection password in 1 to 2 minutes. So, at best,
a sheet protection password provides a hindrance.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"ryguy7272" wrote:

I have the following code in ThisWorkbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub

Private Sub Workbook_Open()
Call ApplySecurity
End Sub

I have this in a Module:
Sub ApplySecurity()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
End Sub

I just noticed that whether macros are enabled or disabled, a user can just
click Tools Protection Unprotect and make any changes they want; Excel
doesnt even ask me for a password. Did I miss something here?

Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to setup a excel sheet to be protect after save and close file Marco Excel Discussion (Misc queries) 0 March 11th 08 10:56 PM
Can I protect a document and still open / close groups Paul Excel Worksheet Functions 1 September 25th 06 06:47 PM
Auto Open, Refresh, Save, Close Jimmycooker Excel Discussion (Misc queries) 0 February 6th 06 01:34 PM
auto open, auto close mike allen[_2_] Excel Programming 1 December 31st 04 09:20 AM
auto close while MsgBox is open Kevin Excel Programming 2 November 10th 03 12:36 AM


All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"