Header and Footer Dialog
- 2 minutes to read
The Header/Footer dialog allows end-users to insert custom headers and footers at the top and bottom of a printed worksheet. The Header/Footer dialog is invoked when an end-user clicks the Custom Header/Footer... button in the Page Setup dialog.
To add the header or footer to a worksheet, an end-user should type the required text in the header or footer Left, Center, or Right section box. End-users can also use buttons located between the header and footer sections to insert specific codes that enable including dynamic information into a header or footer, such as a page number, current date and time, filename, worksheet name, and so on.
End-users can also type the header and footer code preceded by an ampersand directly in the required header or footer section. The supported header and footer codes are listed in the table below.
|&P||Inserts the current page number.|
|&N||Inserts the total number of pages in a workbook.|
|&D||Inserts the current date.|
|&T||Inserts the current time.|
|&Z||Inserts the workbook file path.|
|&F||Inserts the name of a workbook file.|
|&A||Inserts the name of a worksheet.|
|&&||Inserts the ampersand character.|
To specify headers and footers in code, use the Worksheet.HeaderFooterOptions property. For an example, refer to the How to: Add Headers and Footers to a Worksheet Printout topic.