DesignerDocument Object
Collapse the table of content
Expand the table of content

DesignerDocument Object

Represents the active HTML document.

This object implements the following interfaces


The Document object contains all property information related to the HTML in a Web page such as background color, link color, and style sheet as well as methods that act on the data such as the CreateElement and ExecCommand methods.

Use the ActiveDocument property of the Application object or the Document property of the PageWindow object to return an Document object. The following example modifies the background color of the current document.

Visual Basic for Applications
Sub Document()
    Dim objDoc As DesignerDocument
    Dim objWindow As PageWindow
    'Create a reference to the active page window.
    Set objWindow = ActivePageWindow
    'Create a reference to the currently open document.
    Set objDoc = objWindow.Document
    objDoc.bgColor = "yellow"
End Sub
There is no way to access the contents of a Web page using Microsoft Visual Basic for Applications in Office SharePoint Designer without first opening the document and setting it as the active document using either the ActivePageWindowproperty, as shown in the preceding example, or the ActiveDocument property.

The PageWindow object, in the Office SharePoint Designer object model, contains both an ActiveDocument property and a Document property. Both properties return an Document object. However, when a FRAMESET element is contained within a page, the Document property returns the page containing the FRAMESET element, and the ActiveDocument property returns the page referenced in the src attribute of the FRAME element where the insertion point currently resides.

Community Additions

© 2015 Microsoft