Suppress First Page Header

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working in Excel 2002.

How can I suppress a header on the first page, but have it print on the
pages that follow.

The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued)

Thanks
 
Hi Ron, I have tried this macro, but my header does not appear on the second
page. I changed the coding to this:

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub

Do I need to include:

.CenterFooter = "&8Page &P & of &N"
.RightFooter = "&8Last Saved : &B" &
ActiveWorkbook.BuiltinDocumentProperties("Last Save Time")
.LeftFooter = "&8" & ActiveWorkbook.FullName & Chr(10) & "Sheetname
: &B" & ActiveSheet.Name

Thanks
 
Hi Ron, I'm sorry I forgot to mention that the document is protected, would
that prevent the macro from working.
 
Hi Jamie

I read in your other thread that you got it working
Sorry I don't tell you that this macro also print ( you not use the print button of excel)
 
Hi Ron, thanks for your solution. I have another question. Can I add coding
to the macro so the user can either use the print button or File, Print. I'd
like to avoid creating a print button on the worksheet.
 
Hi Jamie

You can use the beforeprint event to do this in the thisworkbook module
If you press the print button your code will run (I use a sheet named "Sheet1" in the example)

See this page for more info about events
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim TotPages As Long
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.RightHeader = "Your Header info"
ActiveSheet.PrintOut From:=1, To:=1
.RightHeader = ""
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top