footer on last page of document


Posted by Carrie Hoffmaster on July 25, 2001 6:39 AM

Hello,

I'm trying to find a way to put a custom footer on the last page of my excel document. The catch is, that I don't know how many pages the document will be until all of the information is entered.
It might be 2 pages this week, 3 pages the next. Select print area will have to be used to leave off part of the document, but on the very last page, I would like to have a custom message. Only on the last page, or it would look ridiculous.
Can anybody help?

Posted by Ivan F Moala on July 26, 2001 3:46 AM

You could do this via VBA;

I've left you the options of choosing
Left, centre,right.......also change cells
you want to reference the custom msg from.

If you require Help then repost.

Ivan

Sub Prt_FooterOnLastPage()
Dim LastPage
Dim Lft As String, Ctr As String, Rght As String

Lft = ActiveSheet.Range("A1") 'Left Text to print
Ctr = ActiveSheet.Range("B1") 'Centre text to print
Rght = ActiveSheet.Range("C1") 'Right Txt to Prt
LastPage = ExecuteExcel4Macro("GET.DOCUMENT(50)")

If LastPage = 1 Then GoTo OnePage

With ActiveSheet.PageSetup
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
End With

ActiveWindow.SelectedSheets.PrintOut From:=1, To:=LastPage - 1

OnePage:
With ActiveSheet.PageSetup
'ActiveSheet.Range("A1") 'change A1 to your cell input
.LeftFooter = "&l" & "&""Arial Black,Bold""&12" & Lft
'ActiveSheet.Range("B1") 'change B1 to your cell input
.CenterFooter = "&""Arial Black,Bold""&8 " & Ctr
' ActiveSheet.Range("C1") 'change C1 to your cell input
.RightFooter = "&""Times New Roman,Bold""&16 " & Rght
End With

ActiveWindow.SelectedSheets.PrintOut From:=LastPage, To:=LastPage

'ActiveWindow.SelectedSheets.PrintPreview

End Sub



Posted by Nag on September 04, 2001 7:45 AM

I want my own text in the last page of the footer.But I donot know in which page of my word document is my last footer.Can any one help me.
Thanks