Syntax

expression.HasPassword

expression A variable that represents a Workbook object.

Remarks

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

Example

This example displays a message if the active workbook has a protection password.

Visual Basic for Applications
If ActiveWorkbook.HasPassword = True Then MsgBox "Remember to obtain the workbook password" & Chr(13) & _ " from the Network Administrator." End If
Detect password protection? Find out if workbook has been protected by password? has password Has Password Property HasPassword haspassword property visual basic source code to password protect individual sheets in excel

See also: