Rediger

Del via


Document.Sections property (Word)

Returns a Section collection that represents the sections in the specified document. Read-only.

Syntax

expression. Sections

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an object from a collection.

Example

This example sets the page orientation for all the sections in the active document.

For Each sec In ActiveDocument.Sections 
 sec.PageSetup.Orientation = wdOrientLandscape 
Next sec

This example creates a new document then adds some text to the document. It then creates a new section in the document and inserts text into the new section.

Set myDoc = Documents.Add 
Selection.InsertAfter "This is section 1." 
Set mysec = myDoc.Sections.Add 
mysec.Range.InsertAfter "This is section 2"

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.