Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default VBA Printing Custom Footer on all but last page

I need to print a custom footer on all but the last printed page of a sheet.
The last page can be of varied number.I have a basic knowledge of VBA and the
macro I have written is not working very wel.
Can somebody provide me with a correct macro that will do the job so that I
can compare were I have gone wrong.
Thanks.
--
james cassidy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default VBA Printing Custom Footer on all but last page

Revision of Ron de Bruin code from http://www.rondebruin.nl/print.htm#not

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

Assuming TotPages = 7

ActiveSheet.PrintOut From:=1, To:=TotPages - 1 prints 1 to 6 with footer

ActiveSheet.PrintOut From:=TotPages, To:=TotPages prints 7 to 7 no footer


Gord Dibben MS Excel MVP

On Thu, 1 Apr 2010 11:12:01 -0700, Caruna
wrote:

I need to print a custom footer on all but the last printed page of a sheet.
The last page can be of varied number.I have a basic knowledge of VBA and the
macro I have written is not working very wel.
Can somebody provide me with a correct macro that will do the job so that I
can compare were I have gone wrong.
Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default VBA Printing Custom Footer on all but last page

thank you works well I can see the erro of my ways
--
james cassidy


"Caruna" wrote:

I need to print a custom footer on all but the last printed page of a sheet.
The last page can be of varied number.I have a basic knowledge of VBA and the
macro I have written is not working very wel.
Can somebody provide me with a correct macro that will do the job so that I
can compare were I have gone wrong.
Thanks.
--
james cassidy

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
Format page number in excel footer to start at a specific page # straitctrydncr Excel Discussion (Misc queries) 4 April 28th 23 07:45 PM
Is there a way to begin printing a footer on page two in Excel? Dre08 Excel Discussion (Misc queries) 1 July 14th 06 07:38 PM
Custom Footer for each page NAVEEN Excel Worksheet Functions 0 February 21st 06 11:04 AM
How do i get page 1 of 1 in a custom Footer Den New Users to Excel 3 April 9th 05 05:55 PM
Printing/Page Numbering in Footer Abi Excel Discussion (Misc queries) 1 January 12th 05 01:12 AM


All times are GMT +1. The time now is 01:51 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"