how to set auto protect workbook on exit?

D

Dave Peterson

I'm not sure what you mean by auto protect workbook. But I try not to do
anything when I'm exiting the workbook.

Anything that you do would have to be saved to take effect for the next time.

If the user opens the workbook and screws it up really, really bad--deletes 32
worksheets(!) and then tries to close without saving and your code does a couple
of things and then saves the workbook, the user won't be happy.

You may want to try to piggyback on when the user saves the file or you may want
to rely on macros being enabled when the workbook opens and protect it then.
 
G

Gord Dibben

Not clear what you want to do.

There are 3 levels of protection in Excel......4 if you count VBA project
protection.

1. File open protection. Requires a password to open the file. File>Save
As>Tools>General Options>Password to open is set here.

2. Workbook protection to protect structure and windows. Password to remove
can be set under Tools>Protection>Protect Workbook.

3. Worksheet protection to prevent sheet changes. Password to remove can be
set ynder Tools>Protection>Protect Worksheet.

Which of these do you want to set?


Gord Dibben MS Excel MVP

On Thu, 14 Sep 2006 21:09:02 -0700, West <[email protected]> wrote:
 
W

West

Dear Dave and Gord,

I'm quite used to the <Tool><Protection><Protect><Password> or the
<tool><option><security> procedures.

The problem usually arise as follows :-

I've created a few shared spreedsheet for reporting purposes with some of
the ranges protected for my own certification.

The problem is, sometimes after unprotecting, making changes or updating the
protected ranges, I tend to close the file without turning the 'protect
function' back on and thus having others acces to the protected ranges.

West,
Langkawi Island, malaysia


Dave Peterson said:
I'm not sure what you mean by auto protect workbook. But I try not to do
anything when I'm exiting the workbook.

Anything that you do would have to be saved to take effect for the next time.

If the user opens the workbook and screws it up really, really bad--deletes 32
worksheets(!) and then tries to close without saving and your code does a couple
of things and then saves the workbook, the user won't be happy.

You may want to try to piggyback on when the user saves the file or you may want
to rely on macros being enabled when the workbook opens and protect it then.
 
D

Dave Peterson

I would still protect the worksheet when the workbook is opened.
Dear Dave and Gord,

I'm quite used to the <Tool><Protection><Protect><Password> or the
<tool><option><security> procedures.

The problem usually arise as follows :-

I've created a few shared spreedsheet for reporting purposes with some of
the ranges protected for my own certification.

The problem is, sometimes after unprotecting, making changes or updating the
protected ranges, I tend to close the file without turning the 'protect
function' back on and thus having others acces to the protected ranges.

West,
Langkawi Island, malaysia
 
Top