Bewerken

Delen via


Window.Caption property (Excel)

Returns or sets a Variant value that represents the name that appears in the title bar of the document window.

Syntax

expression.Caption

expression A variable that represents a Window object.

Remarks

When you set the name, you can use that name as the index to the Windows collection (as demonstrated in the example.)

Example

This example sets the name of the first window in the active workbook to Consolidated Balance Sheet. This name is then used as the index to that window in the Windows collection.

ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet" 
ActiveWorkbook.Windows("Consolidated Balance Sheet") _ 
 .ActiveSheet.Calculate

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.