Section Object

Microsoft Publisher Visual Basic

Section Object

Document Sections
Section

Represents a Section of a publication or document.

Using the Section Object

Use Sections.Item(index) where index is the index number, to return a single Section object. The following example sets a Section object to the first section in the Sections collection of the active document.

    Dim objSection As Section
Set objSection = ActiveDocument.Sections.Item(1)
  

Use Sections.Add(StartPageIndex) where StartPageIndex is the index number of the page, to return a new section added to a document. A "Permission denied." error will be returned if the page already contains a section head. The following example adds a Section object to the second page of the active document.

    Dim objSection As Section
Set objSection = ActiveDocument.Sections.Add(StartPageIndex:=2)