Window Object

Description

Represents a window. Many document characteristics, such as scroll bars and rulers, are actually properties of the window. The Window object is a member of the Windows collection. 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.

Using the Window Object

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.

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.

MsgBox Windows(1).Caption
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.

ActiveWindow.NewWindow
NewWindow
Windows.Add
Remarks

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.

Properties

Active property, ActivePane property, Application property, Caption property, Creator property, DisplayHorizontalScrollBar property, DisplayRulers property, DisplayScreenTips property, DisplayVerticalRuler property, DisplayVerticalScrollBar property, Document property, DocumentMap property, DocumentMapPercentWidth property, Height property, HorizontalPercentScrolled property, Index property, Left property, Next property, Panes property, Parent property, Previous property, Selection property, Split property, SplitVertical property, StyleAreaWidth property, Top property, Type property, VerticalPercentScrolled property, View property, Width property, WindowNumber property, WindowState property.

Methods

Activate method, Close method, LargeScroll method, NewWindow method, PageScroll method, PrintOut method (Application, Document, and Window objects), SmallScroll method.