Sheet protection complications

R

Robert Crandal

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
 
L

Libby

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
 
R

Robert Crandal

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??
 
R

Robert Crandal

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
 
A

Abdul

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top