ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I print a footer on the last page only of an excel doc? (https://www.excelbanter.com/excel-discussion-misc-queries/36612-how-do-i-print-footer-last-page-only-excel-doc.html)

CLDelafield

How do I print a footer on the last page only of an excel doc?
 
How do I print a footer on the last page only of an excel doc? Is this
possible?

Ron de Bruin

Hi

Only with code

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


"CLDelafield" wrote in message ...
How do I print a footer on the last page only of an excel doc? Is this
possible?




Jim Cone

CLD,

Print all pages except the last page.
Add the footer information.
Print the last page.
Close the workbook without saving.

Jim Cone
San Francisco, USA


"CLDelafield" wrote in message
...
How do I print a footer on the last page only of an excel doc?
Is this possible?

DNA

If, when you say pages, you're referring to sheets or worksheets, then the
answer is simple.

If you place a header or a footer on Sheet1, it does not automatically go
to the other sheets; therefore, put your footer on the last worksheet and
print all pages.

HTH and I'm not missing something.


Jim May

Even at xl2003 version, are we still bound to "Excel4Macro" code to acheive
TotPages? hummm..
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
TIA,


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

Only with code

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


"CLDelafield" wrote in message
...
How do I print a footer on the last page only of an excel doc? Is this
possible?






Ron de Bruin

Hi Jim

As far as I know Yes

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


"Jim May" wrote in message news:nh8Ee.81579$Fv.72754@lakeread01...
Even at xl2003 version, are we still bound to "Excel4Macro" code to acheive TotPages? hummm..
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
TIA,


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

Only with code

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


"CLDelafield" wrote in message ...
How do I print a footer on the last page only of an excel doc? Is this
possible?








TC

How do I print a footer on the last page only of an excel doc?
 
I have some experience with VB code but not much. Could someone please
explain what parts of this code I have to edit and enter specific information
for my worksheet to get this code to run.
Thanks
Tim

Ron de Bruin

How do I print a footer on the last page only of an excel doc?
 
Hi Tc

I not see code but I have this on my site
http://www.rondebruin.nl/print.htm#Header

You can do 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



"TC" wrote in message ...
I have some experience with VB code but not much. Could someone please
explain what parts of this code I have to edit and enter specific information
for my worksheet to get this code to run.
Thanks
Tim




TC

How do I print a footer on the last page only of an excel doc?
 
Ron,
I was using your code from below.
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

Is there any way for the code to recognize the footer information that I
have typed in for the worksheet. Instead of having to type it in the line
..rightfooter = "Your Header info"
Also how do you change the code so that it prints on the first page and not
on any of the remaining pages?

Thanks
Tim

"Ron de Bruin" wrote:

Hi Tc

I not see code but I have this on my site
http://www.rondebruin.nl/print.htm#Header

You can do 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



"TC" wrote in message ...
I have some experience with VB code but not much. Could someone please
explain what parts of this code I have to edit and enter specific information
for my worksheet to get this code to run.
Thanks
Tim





Ron de Bruin

How do I print a footer on the last page only of an excel doc?
 
I was using your code from below.

The code I posted is not the site code but only print the footer on the last page

Is there any way for the code to recognize the footer information that I
have typed in for the worksheet. Instead of having to type it in the line
.rightfooter = "Your Header info"


Add your header info in a cell outside you print area
You can use this value in the macro then.

Also how do you change the code so that it prints on the first page and not
on any of the remaining pages?


Sub Test2()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.RightFooter = Range("Z1").Value
ActiveSheet.PrintOut From:=1, To:=TotPages - 1, preview:=True
.RightFooter = ""
ActiveSheet.PrintOut From:=2, To:=TotPages, preview:=True
End With
End Sub


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



"TC" wrote in message ...
Ron,
I was using your code from below.
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

Is there any way for the code to recognize the footer information that I
have typed in for the worksheet. Instead of having to type it in the line
.rightfooter = "Your Header info"
Also how do you change the code so that it prints on the first page and not
on any of the remaining pages?

Thanks
Tim

"Ron de Bruin" wrote:

Hi Tc

I not see code but I have this on my site
http://www.rondebruin.nl/print.htm#Header

You can do 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



"TC" wrote in message ...
I have some experience with VB code but not much. Could someone please
explain what parts of this code I have to edit and enter specific information
for my worksheet to get this code to run.
Thanks
Tim







TC

How do I print a footer on the last page only of an excel doc?
 
Ron,
Thank you very much for all of your help. I think I have envery thing
working the way I want.
Thanks
Tim

TC

How do I print a footer on the last page only of an excel doc?
 
Ron,
When I run the code in the VB editor it does everything that I want it to.
However when I go to print preview in Excel the footer information doesn't
appear. Or when I go to view header/ footer it is not thier either. In my
earlier attempts to get everything working it did appear in the view header/
footer but I have not been able to repete this. I know there is an auto open
feature for macros in Excel but I have not been able to figure it out.

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With Worksheets("Sheet1").PageSetup
..CenterFooter = Worksheets("Sheet2").Range("A1:A2").Value
ActiveSheet.PrintOut From:=1, To:=TotPages - 1, preview:=True
..CenterFooter = ""
ActiveSheet.PrintOut From:=2, To:=TotPages, preview:=True
End With
End Sub

Thank you for all of your help.
Tim

Ron de Bruin

How do I print a footer on the last page only of an excel doc?
 
It Clear the footer for the last pages so that's why you not see it

.CenterFooter = ""




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



"TC" wrote in message ...
Ron,
When I run the code in the VB editor it does everything that I want it to.
However when I go to print preview in Excel the footer information doesn't
appear. Or when I go to view header/ footer it is not thier either. In my
earlier attempts to get everything working it did appear in the view header/
footer but I have not been able to repete this. I know there is an auto open
feature for macros in Excel but I have not been able to figure it out.

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With Worksheets("Sheet1").PageSetup
.CenterFooter = Worksheets("Sheet2").Range("A1:A2").Value
ActiveSheet.PrintOut From:=1, To:=TotPages - 1, preview:=True
.CenterFooter = ""
ActiveSheet.PrintOut From:=2, To:=TotPages, preview:=True
End With
End Sub

Thank you for all of your help.
Tim





All times are GMT +1. The time now is 11:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com