View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
TC TC is offline
external usenet poster
 
Posts: 32
Default 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