Class DocumentWindow (PowerPoint VBA)

The class DocumentWindow represents a document window. The DocumentWindow object is a member of the DocumentWindows collection. The DocumentWindows collection contains all the open document windows.

The main procedures of class DocumentWindow are Activate and Close

Set

To use a DocumentWindow class variable it first needs to be instantiated, for example

Dim dww as DocumentWindow
Set dww = ActiveWindow

The following procedures can be used to set variables of type DocumentWindow: Application.ActiveWindow, NewWindow, DocumentWindows.Item, Presentation.NewWindow, Application.Windows and Presentation.Windows

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Format with its procedures Height and Width

Methods

These are the main methods of the DocumentWindow class

Activate - Activates the specified object.

ActiveWindow.Activate

Close - Closes the specified document window.

ActiveWindow.Close

Other Methods

ExpandSection - Expands the section in the current DocumentWindow.

Dim lngsectionIndex As Long: lngsectionIndex = 
ActiveWindow.ExpandSection sectionIndex:=lngsectionIndex, Expand:=True

LargeScroll - Scrolls through the specified document window by pages.

ActiveWindow.LargeScroll Down:=3

RangeFromPoint - Returns the Shape shape that is located at the point specified by the screen position coordinate pair. If no shape is located at the coordinate pair specified, then the method returns Nothing.

Dim lngX As Long: lngX = 240
Dim lngY As Long: lngY =  300
Dim shpRangeFromPoint As Shape
Set shpRangeFromPoint = ActiveWindow.RangeFromPoint(X:=lngX, Y:=lngY)

ScrollIntoView - Scrolls the document window so that items within a specified rectangular area are displayed in the document window or pane.

ActiveWindow.ScrollIntoView Left:=, Top:=, Width:=, Height:=

SmallScroll - Scrolls through the specified document window by lines and columns.

ActiveWindow.SmallScroll  Down:=3

Properties

Active returns whether the specified pane or window is active.

Dim mtsActive As Office.MsoTriState
mtsActive = Windows(2).Active

ActivePane returns a Pane object that represents the active pane in the document window.

Dim panActivePane As Pane
Set panActivePane = ActiveWindow.ActivePane

BlackAndWhite determines whether the document window display is black and white.

ActiveWindow.BlackAndWhite = msoTrue

Caption returns the text that appears in the title bar of the document window.

Dim strCaption As String
strCaption = ActiveWindow.Caption

Left returns or sets a Single that represents the distance in points from the left edge of the document, application, and slide show windows to the left edge of the application window's client area. Setting this property to a very large positive or negative value may position the window completely off the desktop.

ActiveWindow.Left =

Panes returns a Panes collection that represents the panes in the document window.

Dim pnsPanes As Panes
Set pnsPanes = ActiveWindow.Panes

Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = ActiveWindow.Parent

Presentation returns a Presentation object that represents the presentation in which the specified document window or slide show window was created.

Dim prsPresentation As Presentation
Set prsPresentation = ActiveWindow.Presentation

Selection returns a Selection object that represents the selection in the specified document window.

Dim slcSelection As Selection
Set slcSelection = ActiveWindow.Selection

SplitHorizontal returns or sets the percentage of the document window width that the outline pane occupies in normal view. Corresponds to the pane divider position between the slide and outline panes.

ActiveWindow.SplitHorizontal =

SplitVertical returns or sets the percentage of the document window height that the slide pane occupies in normal view. Corresponds to the pane divider position between the slide and notes panes.

ActiveWindow.SplitVertical =

Top returns or sets a Single that represents the distance in points from the top edge of the document, application, and slide show window to the top edge of the application window's client area.

ActiveWindow.Top = 10

View returns a View object that represents the view in the specified document window.

Dim vwView As View
Set vwView = ActiveWindow.View

ViewType returns or sets the type of the view contained in the specified document window.

ActiveWindow.ViewType = ppViewHandoutMaster

WindowState returns or sets the state of the specified window.

ActiveWindow.WindowState = ppWindowMaximized

DocumentWindows.Count returns the number of objects in the specified collection.

Dim lngCount As Long
lngCount = ActivePresentation.Windows.Count

DocumentWindows.Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = ActivePresentation.Windows.Parent