Project.CheckoutProject 方法 (Project)
簽出目前處於唯讀模式的開啟專案。
語法
expression。 CheckoutProject
表達 代表 Project 物件的變數。
傳回值
Nothing
註解
如果Project 專業版中的使用中專案處於唯讀模式,CheckoutProject.方法會取出專案,使其處於讀取/寫入模式以供編輯。 如果使用中專案已取出,Project 會顯示一個對話方塊,其中包含「此專案已在不同的電腦或Project Web App會話中取出給您」訊息。
範例
下列範例會判斷開啟的專案是否為企業專案,且已取出。如果專案未取出,此範例會嘗試取出專案。 如果專案已取出給您,Project 會顯示一個對話方塊,其中包含錯誤訊息「「此專案已在不同的電腦或Project Web App會話中取出給您」。如果專案由其他使用者取出,Project 會顯示對話方塊,其中包含「若要取出,DOMAIN\UserName必須在其會話中關閉專案,或連絡您的系統管理員以簽入專案」訊息。
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
另請參閱
Application.IsCheckedOutApplication.ProjectCheckOut
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。