title | ms.service | api_name | ms.assetid | ms.date | ms.localizationpriority | |
---|---|---|---|---|---|---|
Project.HasPassword property (Project) |
project-server |
|
2c00e008-94d9-5d0a-d3b9-dcb57af04a19 |
06/08/2017 |
medium |
True if a project has a password. Read-only Boolean.
expression. HasPassword
expression A variable that represents a Project object.
Note
Project can open project files stored in an ODBC database that have a password, but cannot save files to a database.
The following example displays a list of open projects that have passwords.
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.HasPassword 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
End Sub
[!includeSupport and feedback]