Share via


WindowNumber Property

Returns the window number of the document displayed in the specified window. For example, if the caption of the window is "Sales.doc:2", this property returns the number 2. Read-only Long.

expression.WindowNumber

expression Required. An expression that returns a Window object.

Remarks

Use the Index property to return the number of the specified window in the Windows collection.

Example

This example retrieves the window number of the active window, opens a new window, and then activates the original window.

Sub WinNum()
    Dim lwindowNum As Long

    lwindowNum = ActiveDocument.ActiveWindow.WindowNumber
    NewWindow
    ActiveDocument.Windows(lwindowNum).Activate
End Sub

Applies to | Window Object

See Also | Index Property