From: ryguy7272 on
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
doesn't even ask me for a password. Did I miss something here?

Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
From: Eduardo on
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
> doesn't even ask me for a password. Did I miss something here?
>
> Ryan--
>
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
From: Luke M on
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
> doesn't even ask me for a password. Did I miss something here?
>
> Ryan--
>
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
From: ryguy7272 on
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
> > doesn't even ask me for a password. Did I miss something here?
> >
> > Ryan--
> >
> >
> > --
> > Ryan---
> > If this information was helpful, please indicate this by clicking ''Yes''.