Window.WindowNumber Property

Word Developer Reference

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.

Syntax

expression.WindowNumber

expression   An expression that returns a Window object.

Remarks

Use the 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.

Visual Basic for Applications
  Sub WinNum()
    Dim lwindowNum As Long
lwindowNum = ActiveDocument.ActiveWindow.<strong class="bterm">WindowNumber</strong>
NewWindow
ActiveDocument.Windows(lwindowNum).Activate

End Sub

See Also