Compartilhar via


Section Object

Word Developer Reference

Represents a single section in a selection, range, or document. The Section object is a member of the Sections collection. The Sections collection includes all the sections in a selection, range, or document.

Remarks

Use Sections(Index), where Index is the index number, to return a single Section object. The following example changes the left and right page margins for the first section in the active document.

Visual Basic for Applications
  With ActiveDocument.Sections(1).PageSetup
    .LeftMargin = InchesToPoints(0.5)
    .RightMargin = InchesToPoints(0.5)
End With

Use the Add method or the InsertBreak method to add a new section to a document. The following example adds a new section at the beginning of the active document.

Visual Basic for Applications
  Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Sections.Add Range:=myRange
myRange.InsertParagraphAfter

The following example adds a section break above the first paragraph in the selection.

Visual Basic for Applications
  Selection.Paragraphs(1).Range.InsertBreak _
    Type:=wdSectionBreakContinuous
Bb178874.vs_note(en-us,office.12).gif  Note
The Headers and Footers properties of the specified Section object return a HeadersFooters object.

See Also