Project.CheckoutProject Method (Project)

Office 2013

Checks out an open project that is currently in read-only mode.

Version Added: Project 2013

expression .CheckoutProject

expression A variable that represents a Project object.

Return value

Nothing

If the active project in Project Professional is in read-only mode, the CheckoutProject.method checks out the project so that it is in read/write mode for editing. If the active project is already checked out, Project shows a dialog box with the message, "This project is already checked out to you on a different computer or Project Web App session."

The following example determines whether an open project is an enterprise project and is checked out. If the project is not checked out, the example tries to check out the project. 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, Project shows a dialog box with the message, "To check out, DOMAIN\UserName must close the project in their session or contact your administrator to check in the project."

Sub CheckOutOpenEnterpriseProjects()
    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 whether it is active or not.
            proj.CheckoutProject
            Debug.Print "Attempted to check out: '" & proj.Name & "'"
        End If
    Next proj
End Sub
Show:
© 2015 Microsoft