Export (0) Print
Expand All

_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)

Dim Password As Object
Dim Structure As Object
Dim Windows As Object
Dim _Workbook1 As _Workbook
_Workbook1.Protect(Password, Structure, Windows)

void Protect(
	[In, Optional] object Password, 
	[In, Optional] object Structure, 
	[In, Optional] object Windows
public void Protect(
	/*in*/System.Object Password, 
	/*in*/System.Object Structure, 
	/*in*/System.Object Windows
function Protect(
	 Password : Object, 
	 Structure : Object, 
	 Windows : 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.


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


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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Community Additions

© 2014 Microsoft