共用方式為


Project.ReadOnly 屬性 (Project)

True 是表示 如果專案具有唯讀權限。 唯讀的 Boolean

語法

運算式ReadOnly

表達 代表 Project 物件的變數。

範例

下面範例會將唯讀存取的專案複製為讀寫存取的新檔案。

Sub CopyReadOnlyFiles() 
 
 Dim P As Project ' Project object used in loop 
 Dim OldName As String ' Name of project 
 Dim Path As String ' File path to project 
 Dim NewName As String ' New name of project 
 
 ' Check each open project for read-only access. 
 For Each P In Application.Projects 
 If P.ReadOnly Then ' See if project has read-only access. 
 OldName = P.Name ' Store its name. 
 Path = P.Path ' Store its path. 
 ' Create a new name for the file and save it. 
 NewName = "New " & Left(OldName, Len(OldName) - 4) & ".MPP" 
 P.Activate 
 FileSaveAs Path & PathSeparator & NewName 
 End If 
 Next P 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應