Application.ProjectCheckOut method (Project)
Checks out an open project if it is the active project.
Syntax
expression. ProjectCheckOut
(Name)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Optional | String | The name of the project |
Return value
Boolean
Remarks
An open project must be active for the ProjectCheckOut method to work. If the project is already checked out to you, Project shows a dialog box with the error message, ''This project is already checked out to you on a different computer or Project Web App session." If the project is checked out by another user, the error message is "To check out, DOMAIN\UserName must close the project in their session or contact your administrator to check in the project."
Example
The following example attempts to check out all projects that are opened as read-only.
Sub TestProjectCheckOut()
Dim openProjects As Projects
Dim proj As Project
Set openProjects = Application.Projects
On Error Resume Next
For Each proj In openProjects
If Application.IsCheckedOut(proj.Name) Then
If proj.Type = pjProjectTypeEnterpriseCheckedOut Then
Debug.Print "'" & proj.Name & "'" & " is already checked out."
ElseIf proj.Type = pjProjectTypeNonEnterprise Then
Debug.Print "'" & proj.Name & "'" & " is not an enterprise project."
End If
Else
' Check out the project only if it is the active project.
proj.Activate
Application.ProjectCheckOut
Debug.Print "Attempted to check out: '" & proj.Name & "'"
End If
Next proj
End Sub
See also
Application Object Project.Checkin Method
IsCheckedOut Property Project.CheckoutProject Method
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.