共用方式為


Project.FullName 屬性 (Project)

會取得專案的路徑及檔案名稱。 唯讀的 String

語法

運算式FullName

表達 代表 Project 物件的變數。

註解

FullName 屬性傳回未儲存專案的名稱 (如標題列所示)。

範例

下面範例會提示使用者輸入完整的檔案名稱,然後關閉該檔案;如檔案內容已有變動,則儲存其變更。

Sub CloseFile() 
 Dim P As Project ' Project object used in For Each loop 
 Dim FileName As String ' Full name of a file 
 
 ' Prompt user for the full name of a file. 
 FileName = InputBox$("Close which file? Include its path: ") 
 
 ' Search the open projects for the file. 
 For Each P In Application.Projects 
 
 ' If the file is found, close it. 
 If P.FullName = FileName Then 
 P.Activate 
 FileClose pjSave 
 Exit Sub 
 End If 
 Next P 
 
 ' Inform user if the file is not found. 
 MsgBox ("Could not find the file " & FileName & ".") 
 
End Sub

支援和意見反應

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