ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet protection complications (https://www.excelbanter.com/excel-programming/438545-sheet-protection-complications.html)

Robert Crandal

Sheet protection complications
 
My workbook contains multiple sheets. After a set time
period, the workbook will automatically run code that
will password protect each and EVERY sheet in the workbook.

My question is, what happens if a user decides to password
protect a sheet with his/her own password before my code
automatically tries to do the script above?? It will try to
password protect a sheet that has already been password
protected by the user, therefore it will fail right?? If this is
true, can I prevent users from password protecting their sheets
with their own passwords???

thank u



Libby

Sheet protection complications
 
Hi Robert,

Why don't you protect the sheets in the workbook open event, but set the
Userinterfaceonly property to true which will allow your code to run? You can
then used the cells' locked property to lock and unlock various cells or
ranges.

Alternatively if you have a Excel 2003 or earlier you could disable the
Protection items in the Tools menu.

Libby

"Robert Crandal" wrote:

My workbook contains multiple sheets. After a set time
period, the workbook will automatically run code that
will password protect each and EVERY sheet in the workbook.

My question is, what happens if a user decides to password
protect a sheet with his/her own password before my code
automatically tries to do the script above?? It will try to
password protect a sheet that has already been password
protected by the user, therefore it will fail right?? If this is
true, can I prevent users from password protecting their sheets
with their own passwords???

thank u


.


Robert Crandal

Sheet protection complications
 
Hello Libby.... thanks for your help, as always!

I dont have much experience using the "Userinterfaceonly"
property. What happens when I set this to true? Is it
also an Application object property??



"Libby" wrote in message
...
Hi Robert,

Why don't you protect the sheets in the workbook open event, but set the
Userinterfaceonly property to true which will allow your code to run? You
can
then used the cells' locked property to lock and unlock various cells or
ranges.

Alternatively if you have a Excel 2003 or earlier you could disable the
Protection items in the Tools menu.

Libby



Robert Crandal

Sheet protection complications
 
Hi Libby.... I actually have another question....

Do you know if there is an easy way to set ALL cells on any
given sheet to the "locked" property?? Or must I run
a loop that go's through all cells to set them all to "locked"???

thnx


"Libby" wrote in message
...
Hi Robert,

Why don't you protect the sheets in the workbook open event, but set the
Userinterfaceonly property to true which will allow your code to run? You
can
then used the cells' locked property to lock and unlock various cells or
ranges.

Alternatively if you have a Excel 2003 or earlier you could disable the
Protection items in the Tools menu.

Libby



Abdul[_2_]

Sheet protection complications
 
Cells.locked=true will lock all cells
But only useful if the worksheet is also protected


All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com