本示例检查活动文档的每一节,查找第一页是否有不同的页眉和页脚,如果有就显示一条消息。

Dim secLoop As Section
For Each secLoop In ActiveDocument.Sections
    If secLoop.PageSetup.DifferentFirstPageHeaderFooter = True Then
        Msgbox "Section " & secLoop.Index _
        & " has different first page headers & footers."
    End If
Next secLoop