ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   password protect (https://www.excelbanter.com/excel-programming/304069-password-protect.html)

scrabtree[_2_]

password protect
 
I have a sheet that is password protected and is protected
against comments and scenerios but not objects. I wrote a
macro that would unprotect the sheet, alter a few things,
then reprotect it.

Here is the code: Sheets("Time").Unprotect
Password:="TimeFlash" ... then later Sheets
("Time").Protect Password:="TimeFlash"

However, by default, this protects it against comments,
scenerios and objects. I don't want it to protect against
objects. What is the better code?

Tom Ogilvy

password protect
 
from help on the protect method:

expression.Protect(Password, DrawingObjects, Contents, Scenarios,
UserInterfaceOnly)

so use the appropriate arguments.

--
REgards,
Tom Ogilvy


"scrabtree" wrote in message
...
I have a sheet that is password protected and is protected
against comments and scenerios but not objects. I wrote a
macro that would unprotect the sheet, alter a few things,
then reprotect it.

Here is the code: Sheets("Time").Unprotect
Password:="TimeFlash" ... then later Sheets
("Time").Protect Password:="TimeFlash"

However, by default, this protects it against comments,
scenerios and objects. I don't want it to protect against
objects. What is the better code?




JE McGimpsey

password protect
 
From XL/VBA Help:

Protect Method
...
Protects a chart or worksheet (Syntax 1)...
Syntax 1
expression.Protect(Password, DrawingObjects, Contents, Scenarios,
UserInterfaceOnly)


So

Sheets("Time").Protect _
Password:="TimeFlash", _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=True

In article ,
"scrabtree" wrote:

I have a sheet that is password protected and is protected
against comments and scenerios but not objects. I wrote a
macro that would unprotect the sheet, alter a few things,
then reprotect it.

Here is the code: Sheets("Time").Unprotect
Password:="TimeFlash" ... then later Sheets
("Time").Protect Password:="TimeFlash"

However, by default, this protects it against comments,
scenerios and objects. I don't want it to protect against
objects. What is the better code?



All times are GMT +1. The time now is 11:19 AM.

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