Window.WindowNumber property (Word)

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.

Sub WinNum() 
 Dim lwindowNum As Long 
 
 lwindowNum = ActiveDocument.ActiveWindow.WindowNumber 
 NewWindow 
 ActiveDocument.Windows(lwindowNum).Activate 
End Sub

See also

Window Object

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.