Compartir a través de


_Workbook.Protect Method

Protects a workbook so that it cannot be modified.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Sub Protect ( _
    Password As Object, _
    Structure As Object, _
    Windows As Object _
)
'Usage
Dim instance As _Workbook
Dim Password As Object
Dim Structure As Object
Dim Windows As Object

instance.Protect(Password, Structure, _
    Windows)
void Protect(
    Object Password,
    Object Structure,
    Object Windows
)

Parameters

  • Password
    Type: System.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.

  • Structure
    Type: System.Object

    Optional Object. True to protect the structure of the workbook (the relative position of the sheets). The default value is False.

  • Windows
    Type: System.Object

    Optional Object. True to protect the workbook windows. If this argument is omitted, the windows aren’t protected.

See Also

Reference

_Workbook Interface

_Workbook Members

Microsoft.Office.Interop.Excel Namespace