Share via


Caption Property

Returns a String that represents either the caption text in the title bar or the URL of a page.

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 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

The following 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

Applies to | PageWindowEx Object | WebWindowEx Object