This documentation is archived and is not being maintained.

Workbook.WriteReserved Property

Gets a value that indicates whether the workbook is write-reserved.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in

public virtual bool WriteReserved { get; }

Property Value

true if the workbook is write-reserved; otherwise, false.

Use the SaveAs method to set this property.

The following code example uses the WriteReserved property to determine whether the current workbook is write-reserved. If the workbook is not write-reserved, then the method sets the WritePassword property to a password obtained through user input. Otherwise, the example uses the WriteReservedBy property to display the name of the user who saved the workbook as write-reserved. This example assumes the existence of a method named GetPasswordFromUserInput that obtains a strong password from user input.

private void SetWritePassword()
    if (!this.WriteReserved)
        this.WritePassword = GetPasswordFromUserInput();
        MessageBox.Show("This workbook was saved as Write Reserved." +
            " Please contact " + this.WriteReservedBy + " to add data.");