PageWindow Object

Represents an open editor session and encapsulates the object model that is compatible with the Document object model for Microsoft Internet Explorer 4.0 and later.


The PageWindow object is a member of the PageWindows collection and represents all of the open page windows in the specified Web site. Within the PageWindows collection, individual PageWindow objects are indexed beginning with zero. You can also substitute the Caption property of the PageWindow object instead of the index number when accessing a PageWindow object. This works only when the PageWindow object has already been saved.

Use PageWindows(index), where index is the index number of a page window item, to return a single PageWindow object. The following statement returns the file URL of the first page window item in the PageWindows collection.

Visual Basic for Applications
PgePageOne = WebWindows(0).PageWindows(0).Document.Url

Use the ActiveFrameWindow property to return the active frame of a PageWindow object. The following statement returns the ActiveFrameWindow object.

The active frame is the frame that currently has the focus; it is shown in Office SharePoint Designer with a blue border surrounding it.
Visual Basic for Applications
Set objActiveFrame = WebWindows(1) _

Use the FrameWindow property to return an EditorWindow object, which can then be used to return the frames collection and the content of each of the frames collection pages.

Visual Basic for Applications
Set objFrameWindow = WebWindows(0).ActivePageWindow.FrameWindow

Use the Document property to return the document associated with the PageWindow object. The following statement returns the document associated with the first PageWindow object of the first WebWindow object.

Visual Basic for Applications
Set objDoc = WebWindows(0).PageWindows(0).Document

You can use the IsDirty property to determine whether the PageWindow object is dirty—that is, if it has been modified since the last refresh or save. The isDirty property returns True if the PageWindow object is dirty. The following example saves the PageWindow object if the first item in the PageWindows collection is dirty.

Visual Basic for Applications
Private Sub CheckPageWindowIsDirty()
    Dim objPageWin As PageWindow

    Set objPageWin = WebWindows(0).PageWindows(0)

    If objPageWin.IsDirty = True Then
    End If
End Sub

You can use the ViewMode property to set the view for the page as shown in the following statement. For more information on the enumerated constants available for this property, see the table under the ViewMode property. For the following sample to work, WebWindows requires a Web site to be open.

Visual Basic for Applications
WebWindows(0).PageWindows(0).ViewMode = PageViewHtml

Community Additions