Printing headers and footers

llan_man

New Member
Joined
Nov 6, 2005
Messages
45
Hi

I'm trying to print a sheet with headers and footers using the following code:

Code:
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

This works fine but when I add the following:

Code:
        .CenterHeader = "IN COMMERCIAL CONFIDENCE"
        .LeftFooter = "Printed by : " & Sheets("ADMIN").Range("j8")
        .CenterFooter = "Page " & P & " of  " & N
        .RightFooter = Now
        .PrintOut Copies:=1, Collate:=True

I get a compile error with the ".CenterHeader" highlighted.

Can anyone tell me what I'm doing wrong.

Cheers

Harv
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
Good afternoon Harv

Something like this should do the trick for you:

With ActiveSheet.PageSetup
.CenterHeader = "IN COMMERCIAL CONFIDENCE"
.LeftFooter = "Printed by : " & Sheets("ADMIN").Range("j8")
.CenterFooter = "Page " & P & " of " & N
.RightFooter = Now
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

HTH

DominicB
 

Watch MrExcel Video

Forum statistics

Threads
1,118,811
Messages
5,574,448
Members
412,595
Latest member
slim313
Top