_Workbook.HasPassword Property

True if the workbook has a protection password. Read-only Boolean.

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

bool HasPassword { get; }

Property Value

Type: System.Boolean

You can assign a protection password to a workbook by using the SaveAs method.

Show: