HeaderFooter 属性 (Word)Selection.HeaderFooter property (Word)

返回指定的所选内容的**HeaderFooter** 对象。Returns a HeaderFooter object for the specified selection. 此为只读属性。Read-only.

语法Syntax

expressionexpression. HeaderFooter

_表达式_一个代表**Selection** 对象的变量。expression A variable that represents a Selection object.

说明Remarks

如果选定内容并非位于页眉或页脚,则会出现错误。An error occurs if the selection isn't located within a header or footer.

示例Example

本示例向当前页脚中添加居中的页码。This example adds a centered page number to the current page footer.

With ActiveDocument.ActiveWindow.View 
 .Type = wdPrintView 
 .SeekView = wdSeekCurrentPageFooter 
End With 
Selection.HeaderFooter.PageNumbers.Add _ 
 PageNumberAlignment:=wdAlignPageNumberCenter

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.