ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting the protect option (https://www.excelbanter.com/excel-programming/376651-setting-protect-option.html)

Keith

setting the protect option
 
I have a worksheet that has protection switched on. When a certain routine is
run I need to turn the protection off do the routine then turn it back on
again.

When I initially protect the worksheet I need to set the Edit Objects so
that my routines will run properly.

Unfortunately I can't seem to set that back on again when I turn the protect
back on inside my code.

Is there a way to turn the protect back on and use edit object from within
VBA?


Caroline

setting the protect option
 
This is the code I generally use

'Unprotect
ActiveSheet.Unprotect password:="XXX"

'Protect
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, password:="XXX", DrawingObjects:=True,
UserInterfaceOnly:=False
End With





--
caroline


"Keith" wrote:

I have a worksheet that has protection switched on. When a certain routine is
run I need to turn the protection off do the routine then turn it back on
again.

When I initially protect the worksheet I need to set the Edit Objects so
that my routines will run properly.

Unfortunately I can't seem to set that back on again when I turn the protect
back on inside my code.

Is there a way to turn the protect back on and use edit object from within
VBA?


Keith

setting the protect option
 
Yes but I cant seem to find a command for setting the EditObject part of
protect.

"caroline" wrote:

This is the code I generally use

'Unprotect
ActiveSheet.Unprotect password:="XXX"

'Protect
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, password:="XXX", DrawingObjects:=True,
UserInterfaceOnly:=False
End With





--
caroline


"Keith" wrote:

I have a worksheet that has protection switched on. When a certain routine is
run I need to turn the protection off do the routine then turn it back on
again.

When I initially protect the worksheet I need to set the Edit Objects so
that my routines will run properly.

Unfortunately I can't seem to set that back on again when I turn the protect
back on inside my code.

Is there a way to turn the protect back on and use edit object from within
VBA?


Caroline

setting the protect option
 
Why not setting the individual object property to unlock?
--
caroline


"Keith" wrote:

Yes but I cant seem to find a command for setting the EditObject part of
protect.

"caroline" wrote:

This is the code I generally use

'Unprotect
ActiveSheet.Unprotect password:="XXX"

'Protect
With ActiveSheet
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, password:="XXX", DrawingObjects:=True,
UserInterfaceOnly:=False
End With





--
caroline


"Keith" wrote:

I have a worksheet that has protection switched on. When a certain routine is
run I need to turn the protection off do the routine then turn it back on
again.

When I initially protect the worksheet I need to set the Edit Objects so
that my routines will run properly.

Unfortunately I can't seem to set that back on again when I turn the protect
back on inside my code.

Is there a way to turn the protect back on and use edit object from within
VBA?



All times are GMT +1. The time now is 05:24 PM.

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