Headers And Footers
You can use VBA code to create your own headers and footer. This can give you more flexibility than using the standard header and footer options from the age !etup dialog box. There are three regions in header and three in the footer"
LeftHeader, CenterHeader, RightHeader, LeftFooter, CenterFooter,
. All of these properties accept text strings# and are accessible through the $or%sheet.age!etup ob&ect"
Worksheets("SomeSheet").PageSetup.LeftHeader = "Some e!t"
All of the examples here use
. You can change this to any of the regions listed above.You cannot place bitmap images in the header or footer. 'nstead# place a picture ob&ect somewhere in row one on the wor%sheet# and set (ows To (epeat At Top from the age !etup dialog. This will print below the normal header area.
Cell Values In The Header
You can include the value of a cell in the header. For example# the following code will put the value of cell B) on !heet* into the header of the activesheet.
#ti$eSheet.PageSetup.LeftHeader = %
Full File Name In The Header
The following code will place the full file name# including the path# into the header of the active wor%sheet.
#ti$eSheet.PageSetup.LeftHeader = hisWork+ook.Fu**ame
Fonts And Font Sizes
You can insert control codes to customi+e the font# font attributes ,bold# italics# etc-# and font si+e. The control code used in the header string is the ampersand . The code below will create put the follow formatted text in the header.!ome
Bold Courier New Size 10