Caption Property

       

Returns the text of the title bar for the specified object. Read-only String.

expression.Caption

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

The Caption property returns different values depending on the specified object. For example, the Caption property for the PageWindowEx object returns the file URL of the open page, while the Caption property for the WebWindowEx object returns the text of the title bar for the Microsoft FrontPage application window.

Example

This statement returns the caption of the active page.

myCaption = ActivePageWindow.Caption

This example demonstrates accessing both the active WebWindowEx and PageWindowEx objects using the With and For statements.

Private Sub GetPageWindowCaption()
    Dim myWebWindow As WebWindowEx
    Dim myPageWindows As PageWindows
    Dim myPageWindowCaptions As String
    Dim myWebWindowCaption As String

    Set myWebWindow = Application.ActiveWebWindow
    Set myPageWindows = myWebWindow.PageWindows

    With myWebWindow
        myWebWindowCaption = .Caption
    End With

    For Each myPageWindow In myPageWindows
        myPageWindowCaptions = myPageWindowCaptions & myPageWindow.Caption
    Next
End Sub