共用方式為


Publisher) (Application.Path 屬性

會傳回字串,指出用來儲存使用中出版物的檔案完整路徑,不包括最後的分隔字元或檔案名稱。

語法

運算式路徑

expression 代表 Application 物件的變數。

註解

Document.FullName屬性可用來傳回路徑和檔案名。

範例

下列範例會示範 路徑名稱 、 與 FullName 屬性之間的差異。 本範例會最說明如果出版物儲存在非預設資料夾。

Sub PathNames() 
 
 Dim strPath As String 
 Dim strName As String 
 Dim strFullName As String 
 
 strPath = Application.ActiveDocument.Path 
 strName = Application.ActiveDocument.Name 
 strFullName = Application.ActiveDocument.FullName 
 
 ' Note the file name & path differences 
 ' while executing. 
 MsgBox "The path is: " & strPath 
 MsgBox "The file name is: " & strName 
 MsgBox "The path & file name are: " & strFullName 
 
End Sub

支援和意見反應

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