Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Printing Header on First Page


Hi,

I'm currently using the Workbook Before Print function to add a header
on to my sheet, but every sheet spans two pages. Is there a way of only
printing the header on the first page? Any help would be great! :)

Dave


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Only Printing Header on First Page

hi

Check out
http://www.rondebruin.nl/print.htm#Header

--
Regards Ron de Bruin
http://www.rondebruin.nl


"beans_21" wrote in message
...

Hi,

I'm currently using the Workbook Before Print function to add a header
on to my sheet, but every sheet spans two pages. Is there a way of only
printing the header on the first page? Any help would be great! :)

Dave


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Printing Header on First Page


Thats great and does exactly what I want thanks!!! But there is one
problem! I'm wanting to put that code on the Before Print function, so
what happens is that it prints with the header on the first page and
then not on the second, but then it prints again if you see what i mean
so is there any way of cancelling the second print from coming out?

Thanks,

Dave :)


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Only Printing Header on First Page

Hi Beans

You can use Cancel = true
This example is for "Sheet1" and you must copy it into the thisworkbook module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False

MsgBox "copy your code here"

Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"beans_21" wrote in message
...

Thats great and does exactly what I want thanks!!! But there is one
problem! I'm wanting to put that code on the Before Print function, so
what happens is that it prints with the header on the first page and
then not on the second, but then it prints again if you see what i mean
so is there any way of cancelling the second print from coming out?

Thanks,

Dave :)


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Printing Header on First Page


I can't seem to get it working, I'm quite new to this so it is prob me
being silly, I've attached my code, can you see what I am doing wrong?
It's now just printing one copy off but not with the header !

Thanks a lot for your help :)

Dave


Code:
--------------------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveWorkbook.Name = "Equipment_Booking_v5.2" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False

MsgBox "Your Code Here"
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")

With ActiveSheet.PageSetup
.PrintArea = "$b$2:$az$90"
.Orientation = xlLandscape
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.BlackAndWhite = False
.PrintErrors = xlPrintErrorsDisplayed
.FitToPagesWide = False
.zoom = 55
.CenterHeader = "&U&26Bookings Week Commencing " & (Application.ActiveSheet.Name)
ActiveSheet.PrintOut From:=1, To:=1
.CenterHeader = ""
ActiveSheet.PrintOut From:=2, To:=TotPages
End With

'turn off page breaks
ActiveSheet.DisplayAutomaticPageBreaks = False

Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
--------------------


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Only Printing Header on First Page

Hi

If ActiveWorkbook.Name = "Equipment_Booking_v5.2" Then


You must test the sheet here and not the workbook (see my example)




--
Regards Ron de Bruin
http://www.rondebruin.nl


"beans_21" wrote in message
...

I can't seem to get it working, I'm quite new to this so it is prob me
being silly, I've attached my code, can you see what I am doing wrong?
It's now just printing one copy off but not with the header !

Thanks a lot for your help :)

Dave


Code:
--------------------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveWorkbook.Name = "Equipment_Booking_v5.2" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False

MsgBox "Your Code Here"
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")

With ActiveSheet.PageSetup
.PrintArea = "$b$2:$az$90"
.Orientation = xlLandscape
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.BlackAndWhite = False
.PrintErrors = xlPrintErrorsDisplayed
.FitToPagesWide = False
.zoom = 55
.CenterHeader = "&U&26Bookings Week Commencing " & (Application.ActiveSheet.Name)
ActiveSheet.PrintOut From:=1, To:=1
.CenterHeader = ""
ActiveSheet.PrintOut From:=2, To:=TotPages
End With

'turn off page breaks
ActiveSheet.DisplayAutomaticPageBreaks = False

Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
--------------------


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Printing Header on First Page


Yep you were right, thanks again! :)

Sure you know whats coming now - any way of doing it for the work book
as the sheets names are changing all the time!

Thank you, thank you, thank you


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Only Printing Header on First Page

If you remove

If ActiveSheet.Name = "Sheet1" Then

And the

End If

It will run your code in the activesheet.
Don't know if that is what you want ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"beans_21" wrote in message
...

Yep you were right, thanks again! :)

Sure you know whats coming now - any way of doing it for the work book
as the sheets names are changing all the time!

Thank you, thank you, thank you


--
beans_21
------------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281
View this thread: http://www.excelforum.com/showthread...hreadid=499696



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Printing Header on First Page


Yes that works! You are a legend! Thank you so MUCH!!! Thats ace! Yo
rock thank you!!

Dave
:) :) :) :) :) :) :

--
beans_2
-----------------------------------------------------------------------
beans_21's Profile: http://www.excelforum.com/member.php...fo&userid=3028
View this thread: http://www.excelforum.com/showthread.php?threadid=49969

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header on first page and two sided printing srctr Excel Discussion (Misc queries) 0 February 12th 09 08:06 PM
Printing header row on each page GKW in GA Excel Discussion (Misc queries) 1 June 27th 07 05:52 PM
How do I stop printing a header after the third page? Val Excel Discussion (Misc queries) 1 September 16th 05 11:34 PM
Printing the page properties as header r_najafi Excel Discussion (Misc queries) 1 January 6th 05 02:59 PM
Printing header on all but last page Don Excel Programming 2 December 28th 04 03:33 PM


All times are GMT +1. The time now is 04:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"