# Window.Caption Property

Office 2007
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.

Visual Basic for Applications
``````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.

Visual Basic for Applications
``Application.Caption = ""``

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

Visual Basic for Applications
``ActiveDocument.ActiveWindow.Caption = ActiveDocument.FullName``

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

Visual Basic for Applications
``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."

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