Document.Content Property

Word Developer Reference

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



expression   A variable that represents a Document object.


The following two statements are equivalent:

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


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

See Also