Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.ProjectCheckOut Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Checks out an open project if it is the active project.

Syntax

expression. ProjectCheckOut(Name)

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData typeDescription
NameOptionalStringThe 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

Concepts

Application ObjectProject.Checkin Method

Other resources

IsCheckedOut PropertyProject.CheckoutProject Method

© 2018 Microsoft