_Chart.Protect(Object, Object, Object, Object, Object) Method

Definition

Protects a chart so that it cannot be modified.

public void Protect (object Password, object DrawingObjects, object Contents, object Scenarios, object UserInterfaceOnly);
Public Sub Protect (Optional Password As Object, Optional DrawingObjects As Object, Optional Contents As Object, Optional Scenarios As Object, Optional UserInterfaceOnly As Object)

Parameters

Password
Object

Optional Object. A string that specifies a case-sensitive password for the worksheet or workbook. If this argument is omitted, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook. If you forget the password, you cannot unprotect the worksheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.

DrawingObjects
Object

Optional Object. True to protect shapes. The default value is False.

Contents
Object

Optional Object. True to protect contents. For a chart, this protects the entire chart. For a worksheet, this protects the locked cells. The default value is True.

Scenarios
Object

Optional Object. True to protect scenarios. This argument is valid only for worksheets. The default value is True.

UserInterfaceOnly
Object

Optional Object. True to protect the user interface, but not macros. If this argument is omitted, protection applies both to macros and to the user interface.

Remarks

Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.

Applies to