Table of contents
TOC
折叠目录
展开目录

Window.Caption 属性 (项目)Window.Caption Property (Project)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

获取或设置项目窗口的标题栏中的文本。读/写,字符串Gets or sets the text in the title bar of a project window. Read/write String.

语法Syntax

表达式标题expression. Caption

表达式_一个表示一个窗口对象的变量。_expression A variable that represents a Window object.

注解Remarks

活动窗口最大化时,标题栏将显示这两个主和活动窗口以连字符分隔的标题的标题。例如,如果主窗口的标题是"Microsoft 项目",并在活动窗口的标题是"Project1.mpp",标题栏显示"Project1.mpp-Microsoft Project"当活动窗口处于最大化状态。When the active window is maximized, the title bar displays the caption for both the main and active windows, separating the captions with a hyphen. For example, if the caption for the main window is "Microsoft Project" and the caption for the active window is "Project1.mpp", the title bar displays "Project1.mpp - Microsoft Project" when the active window is maximized.

如果将标题属性设置为,则标题栏将显示的默认标题。主窗口的默认标题为"Microsoft 项目"。If you set the Caption property to Empty, the title bar displays the default caption. The default caption for the main window is "Microsoft Project".

为项目中的一个窗口,该窗口的默认标题是该项目的文件名称。在项目中有多个打开的窗口,每个窗口的默认标题是_名称_: n,_其中_名称_是该项目的文件名称和_n_是窗口的唯一编号。例如,如果项目"项目 1"第二个窗口处于活动状态,默认标题栏显示"Project1.mpp:2-Microsoft 项目"In a project with one window, the default caption for the window is the file name of the project. In a project that has multiple windows open, the default caption for each window is _name: n, where name is the file name of the project and n is a unique number for the window. For example, if the second window of the project "Project1" is active, the default title bar displays "Project1.mpp:2 - Microsoft Project"

示例Example

下面的示例提示用户更改活动窗口的标题。The following example prompts the user to change the caption for the active window.

Sub ChangeWindowCaption() 

 Dim Entry As String ' Caption entered by user 

 ' Prompt user for a new caption. 
 Entry = InputBox$("Enter a new caption for the active window (enter 'reset' to set the caption to its default).") 

 ' If user chooses the Cancel button, exit Sub procedure. 
 If Entry = Empty Then Exit Sub 

 ' Set or reset the caption. 
 If Entry = "reset" Then 
 ActiveWindow.Caption = Empty 
 Else 
 ActiveWindow.Caption = Entry 
 End If 

End Sub
© 2018 Microsoft