True if a project has a password. Read-only Boolean.
Syntax
expression.HasPassword
expression A variable that represents a Project object.
Example
The following example displays a list of open projects that have passwords.
Visual Basic for Applications
Sub ListProjectsWithPasswords()
Dim P As Project ' Project object used in For Each loop
Dim NameList As String ' Names of projects with passwords
' Check each open project for passwords.
For Each P in Application.Projects
' If a project has a password, add its name to the list.
If P.<strong class="bterm">HasPassword</strong> Then
NameList = NameList & P.Name & vbCrLf
End If
Next P
' Display information about projects with passwords.
If NameList = "" Then
MsgBox("No open projects have passwords.")
Else
MsgBox("The following open projects have passwords: " & vbCrLf & vbCrLf & NameList)
End If