View.PreviousHeaderFooter method (Word)

Moves to the previous header or footer, depending on whether a header or footer is displayed in the view.

Syntax

expression. PreviousHeaderFooter

expression Required. A variable that represents a 'View' object.

Remarks

If the view displays a header, this method moves to the previous header within the current section (for example, from an even header to an odd header) or to the last header in the previous section. If the view displays a footer, this method moves to the previous footer.

Note

If the view displays the first header or footer in the first section of the document, or if it is not displaying a header or footer at all, an error occurs.

Example

This example inserts an even section break, switches the active window to print layout view, displays the current header, and then switches to the previous header.

Selection.Collapse Direction:=wdCollapseStart 
Selection.InsertBreak Type:=wdSectionBreakEvenPage 
With ActiveDocument.ActiveWindow.View 
 .Type = wdPrintView 
 .SeekView = wdSeekCurrentPageHeader 
 .PreviousHeaderFooter 
End With

See also

View Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.