no password carryover with "protect sheet" in macro
Jeremy
you haven't actually provided a password:
From the Help:
Syntax 1
expression.Protect(Password, DrawingObjects, Contents, Scenarios,
UserInterfaceOnly)
Syntax 2
expression.Protect(Password, Structure, Windows)
So, you need to add something like:
ActiveSheet.Protect Password := "drowssap"Regards
Trevor
"Jeremy" wrote in message
...
I'm hoping to run a macro on a sheet of data and then have the newly
generated sheet be password protected against any alterations. While
recording a new macro, i go to "Sheet Protection..." and protect the sheet
using the optional password feature. This macro, when used later on, creates
a new sheet of data and the sheet is initially protected when trying to
alter a cell (gives the notificiation of "read-only" but also says the sheet
can be unprotected but a password may be required), but if i simply go to
"Unprotect Sheet..." it allows me to do so without entering a password.
The VBA language,
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
doesn't carryover the password for some reason.
any ideas?
Jeremy
|