Class Window (Word VBA)
The class Window represents a window. Many document characteristics, such as scroll bars and rulers, are actually properties of the window.
To use a Window class variable it first needs to be instantiated, for example
Dim wnd as Window Set wnd = ActiveWindow
Here is an example of processing the Window items in a collection.
Dim win As Window For Each win In Windows win.DisplayVerticalScrollBar = True win.DisplayHorizontalScrollBar = True Next win
Activate - Activates the specified window.
Close - Closes the specified window.
GetPoint - Returns the screen coordinates of the specified range or shape.
LargeScroll - Scrolls a window or pane by the specified number of screens.
NewWindow - Opens a new window with the same document as the specified window. Returns a Window object.
PageScroll - Scrolls through the specified pane or window page by page.
PrintOut - Prints all or part of the document displayed in the specified window.
ScrollIntoView - Scrolls through the document window so the specified range or shape is displayed in the document window.
SetFocus - Sets the focus of the specified document window to the body of an email message.
SmallScroll - Scrolls a window or pane by the specified number of lines.
ToggleRibbon - Shows or hides the ribbon.
Caption (Default member) - Returns or sets the caption text for the window that is displayed in the title bar of the document or application window.
Active true if the specified window is active.
DisplayHorizontalScrollBar true if a horizontal scroll bar is displayed for the specified window.
DisplayLeftScrollBar true if the vertical scroll bar appears on the left side of the document window.
DisplayRightRuler true if the vertical ruler appears on the right side of the document window in print layout view.
DisplayRulers true if rulers are displayed for the specified window or pane.
DisplayScreenTips true if comments, footnotes, endnotes, and hyperlinks are displayed as tips.
DisplayVerticalRuler true if a vertical ruler is displayed for the specified window or pane.
DisplayVerticalScrollBar true if a vertical scroll bar is displayed for the specified window.
DocumentMap true if the document map is visible.
EnvelopeVisible true if the email message header is visible in the document window. The default value is False.
Height returns or sets the height of the window (in points).
HorizontalPercentScrolled returns or sets the horizontal scroll position as a percentage of the document width.
Hwnd returns a Long that indicates the window handle of the specified window.
Index returns a Long that represents the position of an item in a collection.
Left returns or sets a Long that represents the horizontal position of the specified window, measured in points.
Next returns the next document window in the collection of open document windows.
Previous returns the previous document window in the collection open document windows.
ShowSourceDocuments returns or sets a WdShowSourceDocuments constant that represents how Microsoft Word displays source documents after a compare and merge process.
Split true if the window is split into multiple panes.
SplitVertical returns or sets the vertical split percentage for the specified window.
StyleAreaWidth returns or sets the width of the style area in points.
Thumbnails sets or returns a Boolean that represents whether thumbnail images of the pages in a document are displayed along the left side of the Microsoft Word document window.
Top returns or sets the vertical position of the specified document window, in points.
Type returns the window type.
UsableHeight returns the height (in points) of the active working area in the specified document window. Read-only Long.
UsableWidth returns the width (in points) of the active working area in the specified document window.
VerticalPercentScrolled returns or sets the vertical scroll position as a percentage of the document length.
Visible true if the specified object is visible.
Width returns or sets the width of the specified document window, in points.
WindowState returns or sets the state of the specified document window or task window.
Document - Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.
Pane - Represents a window pane. The Pane object is a member of the Panes collection. The Panes collection includes all the window panes for a single window.
Panes - A collection of Pane objects that represent the window panes for a single window.
Range - Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.
Selection - Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can be only one Selection object per document window pane, and only one Selection object in the entire application can be active.
Shape - Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes in the main story of a document or in all the headers and footers of a document.
View - Contains the view attributes (such as show all, field shading, and table gridlines) for a window or pane.