Lock or unlock shapes
Contents
[
Hide
]
Sometimes, you need to protect all shapes in certain worksheets to prevent them from being destroyed by unwanted situations. In this case, you need to lock all shapes in the specified worksheet.
Sometimes, you need to be able to modify certain shapes in certain protected worksheets, in which case, you need to unlock these shapes.
This article will introduce in detail how to lock and unlock specified shapes.
Protect all shapes in a specified worksheet
To protect all shapes in a specified worksheet, use the Worksheet.Protect(type) method, as shown in the following sample code.
Unlock specified shapes in a protected worksheet
To unlock a specified shape in a protected worksheet, use shape.IsLocked, as shown in the following sample code.
Note: shape.IsLocked is meaningful only when the worksheet is protected.