Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}Protects the workbook structure using the supplied password.  End users will not be able to add or remove worksheets unless they enter the password.{excerpt}
{signature:C#}
 public void Protect(System.String password)
{signature}{signature:vb.net}
Public Sub Protect(ByVal password As String)
{signature}
{parameters}
{param:password}The password to use to protect the workbook. If the password = "" or null, then the workbook will be protected without a password.{param}
{remarks}
The equivalent to this action in Excel is to select "Protect structure and windows" from the review menu.

Further protection can be extended to cells by using the [Worksheet.Protect()|Worksheet.Protect(String)] method to protect individual worksheets and by using the [Workbook.EncryptPassword] property to set a password that must be provided to open the workbook.  
{remarks}
{example}{code:csharp|title=C#}
wb.Protect("MyPassword");{code}
{code:vb.net|title=vb.net}
wb.Protect("MyPassword"){code}

{example}