Windows Collection Object

Word Developer Reference

A collection of Window objects that represent all the available windows. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Document object contains only the windows that display the specified document.

Remarks

Use the Windows property to return the Windows collection. The following example tiles all the windows so that they don't overlap one another.

Visual Basic for Applications
  Windows.Arrange ArrangeStyle:=wdTiled

Use the Add method or the NewWindow method to add a new window to the Windows collection. Each of the following statements creates a new window for the document in the active window.

Visual Basic for Applications
  ActiveDocument.ActiveWindow.NewWindow
NewWindow
Windows.Add

Use Windows(Index), where Index is the window name or the index number, to return a single Window object. The following example maximizes the Document1 window.

Visual Basic for Applications
  Windows("Document1").WindowState = wdWindowStateMaximize

The index number is the number to the left of the window name on the Window menu. The following example displays the caption of the first window in the Windows collection.

Visual Basic for Applications
  MsgBox Windows(1).Caption

A colon (:) and a number appear in the window caption when more than one window is open for a document.

When you switch the view to print preview, a new window is created. This window is removed from the Windows collection when you close print preview.

See Also