Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

Document.Content Property

Office 2007
Returns a Range object that represents the main document story. Read-only.

Syntax

expression.Content

expression   A variable that represents a Document object.

Remarks

The following two statements are equivalent:

Visual Basic for Applications
Set mainStory = ActiveDocument.Content
Set mainStory = ActiveDocument.StoryRanges(wdMainTextStory)

Example

This example changes the font and font size of the text in the active document to Arial 10 point.

Visual Basic for Applications
Set myRange = ActiveDocument.Content
With myRange.Font
    .Name = "Arial"
    .Size = 10
End With

This example inserts text at the end of the document named "Changes.doc." The For Each...Next statement is used to determine whether the document is open.

Visual Basic for Applications
For Each aDocument In Documents
    If InStr(LCase$(aDocument.Name), "changes.doc") Then
        Set myRange = Documents("Changes.doc").Content
        myRange.InsertAfter "the end."
    End If
Next aDocument



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.