Window.Caption property (Word)

Returns or sets the caption text for the window that is displayed in the title bar of the document or application window. Read/write String.

Syntax

expression.Caption

expression A variable that represents a Window object.

Remarks

To change the caption of the application window to the default text, set this property to an empty string ("").

Example

This example displays the caption of each window in the Windows collection.

Count = 1 
For Each win In Windows 
 MsgBox Prompt:=win.Caption, Title:="Window" & Str(Count) & _ 
 " Caption" 
 Count = Count + 1 
Next win

This example resets the caption of the application window.

Application.Caption = ""

This example sets the caption of the active window to the active document name.

ActiveDocument.ActiveWindow.Caption = ActiveDocument.FullName

This example changes the caption of the Word application window to include the user name.

Application.Caption = UserName & "'s copy of Word"

This example inserts a Table caption and then changes the caption of the first table of figures to Table.

Selection.Collapse Direction:=wdCollapseStart 
Selection.Range.InsertCaption "Table" 
If ActiveDocument.TablesOfFigures.Count >= 1 Then 
 ActiveDocument.TablesOfFigures(1).Caption = "Table" 
End If

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.