PageNumbers.ChapterPageSeparator 属性 (Word)

返回或设置章节号和页码之间的分隔字符。 读/写 WdSeparatorType

语法

expressionChapterPageSeparator

表达 一个表示“PageNumbers”对象的表达式。

备注

在创建带有章节号的页码之前,文档标题必须应用多级的符号格式从 项目符号和编号对话框中使用的样式。 若要在 Visual Basic 中执行此操作,请使用 ApplyListTemplate 方法。

示例

本示例第一部分创建一个新文档,添加章标题和分页符,然后用“项目符号和编号”对话框中列出的最后一个多级符号格式来设置文档格式。 本示例第二部分向页眉中添加包含章节号的居中的页码,用短划线分隔章节号和页码。

Dim intLoop As Integer 
Dim hfTemp As HeaderFooter 
 
Documents.Add 
For intLoop = 1 To 5 
 With Selection 
 .TypeParagraph 
 .InsertBreak 
 End With 
Next intLoop 
ActiveDocument.Content.Style = wdStyleHeading1 
ActiveDocument.Content.ListFormat.ApplyListTemplate _ 
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _ 
 .ListTemplates(7) 
 
Set hfTemp = ActiveDocument.Sections(1) _ 
 .Headers(wdHeaderFooterPrimary) 
With hfTemp.PageNumbers 
 .Add PageNumberAlignment:=wdAlignPageNumberCenter 
 .NumberStyle = wdPageNumberStyleArabic 
 .IncludeChapterNumber = True 
 .HeadingLevelForChapter = 0 
 .ChapterPageSeparator = wdSeparatorEnDash 
End With

另请参阅

PageNumbers 集合对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。