Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Printing Headers on only first page and Footers on only last page

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
.. or should I use something else than Headers and Footers?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Printing Headers on only first page and Footers on only last page



"JacMar" wrote:

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
. or should I use something else than Headers and Footers?

Thank you


Sorry, I forgot to mention I am using Excel 2002.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Printing Headers on only first page and Footers on only last page

Jac

See Ron de Bruin's site for code.

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


Gord Dibben MS Excel MVP

On Sat, 20 Jan 2007 19:33:33 -0800, JacMar
wrote:

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
. or should I use something else than Headers and Footers?

Thank you


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Printing Headers on only first page and Footers on only last p

Thanks, that should work. I also have to find out how to determine the
number of pages that will print, before I start printing, so I can print a
footer only on the last page. If I can't find out, I will get back to this
group. As you can probably tell, I am a "newbie" to VBA. Thanks again.

"Gord Dibben" wrote:

Jac

See Ron de Bruin's site for code.

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


Gord Dibben MS Excel MVP

On Sat, 20 Jan 2007 19:33:33 -0800, JacMar
wrote:

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
. or should I use something else than Headers and Footers?

Thank you



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Printing Headers on only first page and Footers on only last p

Hi JacMar

This give you the pages
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")


Try this

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.RightFooter = ""
ActiveSheet.PrintOut From:=1, To:=TotPages - 1
.RightFooter = "Your Header info"
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End Sub





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"JacMar" wrote in message ...
Thanks, that should work. I also have to find out how to determine the
number of pages that will print, before I start printing, so I can print a
footer only on the last page. If I can't find out, I will get back to this
group. As you can probably tell, I am a "newbie" to VBA. Thanks again.

"Gord Dibben" wrote:

Jac

See Ron de Bruin's site for code.

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


Gord Dibben MS Excel MVP

On Sat, 20 Jan 2007 19:33:33 -0800, JacMar
wrote:

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
. or should I use something else than Headers and Footers?

Thank you





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Printing Headers on only first page and Footers on only last p


Printing Headers on only first page and Footers on only last p


I only read the last posting in the thread about only footer on last page

But try this for header on first page and footer on last page

Test TotPages to see if there are enough pages

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.RightFooter = ""
.RightHeader = "Your Header info"
ActiveSheet.PrintOut From:=1, To:=TotPages - 1

.RightFooter = ""
.RightHeader = ""
ActiveSheet.PrintOut From:=2, To:=TotPages - 1

.RightFooter = "Your footer info"
.RightHeader = ""
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" wrote in message ...
Hi JacMar

This give you the pages
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")


Try this

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.RightFooter = ""
ActiveSheet.PrintOut From:=1, To:=TotPages - 1
.RightFooter = "Your Header info"
ActiveSheet.PrintOut From:=TotPages, To:=TotPages
End With
End Sub





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"JacMar" wrote in message ...
Thanks, that should work. I also have to find out how to determine the
number of pages that will print, before I start printing, so I can print a
footer only on the last page. If I can't find out, I will get back to this
group. As you can probably tell, I am a "newbie" to VBA. Thanks again.

"Gord Dibben" wrote:

Jac

See Ron de Bruin's site for code.

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


Gord Dibben MS Excel MVP

On Sat, 20 Jan 2007 19:33:33 -0800, JacMar
wrote:

I'm controlling the printing of a sheet of various lenght with a macro. How
do I ensure that the Header only prints on the first page, and the Footer
only on the last page. The pages will vary from one to three or four. . .
. or should I use something else than Headers and Footers?

Thank you


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
Excel Headers and Footers Printing out Lion2004 Excel Discussion (Misc queries) 1 December 19th 06 10:39 AM
How do I get rid of an extra page before printing on an excel sp. delhi Excel Worksheet Functions 1 June 17th 06 04:42 AM
1st page only Headers & Footers Etijian Excel Discussion (Misc queries) 3 August 3rd 05 03:31 PM
If I change page margins headers don't line up??? CGINUSA Excel Discussion (Misc queries) 2 June 25th 05 12:54 PM
Better support for dynamic content within headers and footers Anvil Scott Excel Discussion (Misc queries) 1 December 21st 04 08:33 PM


All times are GMT +1. The time now is 11:35 PM.

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"