Workbook.WritePassword Property (2007 System)
Gets or sets the write password of a workbook.
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
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 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.
This example is for a document-level customization.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.