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 支持和反馈,获取有关如何接收支持和提供反馈的指南。