Table of contents
TOC
折叠目录
展开目录

Project.CheckoutProject 方法 (项目)Project.CheckoutProject Method (Project)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

签出当前处于只读模式打开项目。Checks out an open project that is currently in read-only mode.

语法Syntax

表达式CheckoutProjectexpression. CheckoutProject

表达式_一个表示项目对象的变量。_expression A variable that represents a Project object.

返回值Return value

执行任何操作Nothing

注解Remarks

如果活动项目中,项目专家是在只读模式下, CheckoutProject方法将签出该项目,这样就在读/写模式下进行编辑。如果活动项目已签出,项目显示消息对话框,"此项目已签出给您在其他计算机或 Project Web App 会话。"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."

示例Example

下面的示例确定是否打开企业项目和项目已签出。如果项目未签出,则此示例将尝试签出项目。如果该项目已签出给您的项目将显示一个对话框,并显示错误消息,'此项目已签给您不同计算机或 Project Web App 会话上。"如果项目已签出被其他用户,项目显示一个对话框,并显示消息,"要签出,域 \ 用户名_必须在会话中关闭项目或与管理员联系以签入该项目。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

另请参阅See also

概念Concepts

项目对象签入方法Project ObjectCheckin Method

其他资源Other resources

Application.IsCheckedOutApplication.ProjectCheckOutApplication.IsCheckedOutApplication.ProjectCheckOut

© 2018 Microsoft