多种对象![]() ![]() ![]() |
本对象代表选定内容、范围或文档中的某一节。Section 对象为 Sections 集合的一个成员。Sections 集合包含了选定内容、范围或文档中的所有节。
可用 Sections(index) 返回单独的 Section 对象,其中 index 为索引号。下例修改活动文档第一节的左、右页边距。
With ActiveDocument.Sections(1).PageSetup
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
End With
可用 Add 方法或 InsertBreak 方法在文档中添加新的节。下例在活动文档的开头添加一节。
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Sections.Add Range:=myRange
myRange.InsertParagraphAfter
下例在选定内容的第一段之前添加一分节符。
Selection.Paragraphs(1).Range.InsertBreak _
Type:=wdSectionBreakContinuous
注意 指定 Section 对象的 Headers 和 Footers 属性返回一个 HeadersFooters 对象。