Rediger

Del via


Document.Content property (Word)

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:

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.

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.

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

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.