Fit to page in macro
here is a print setup i did on record then modified.
i think you might need to a .zoom = something.
With ActiveSheet.PageSetup
.LeftHeader = "&D" & Chr(10) & LHeadTC & " " & "Total
Items"
.CenterHeader = "&16Top 50 Line Items WIP"
.RightHeader = _
"Top 50 Value Total WIP Value Percent" & Chr
(10) & _
RHead & " " & RHead1 & " " & RHead2 &
Chr(10) & _
"Top 120 Value Total WIP Value Percent" & Chr
(10) & _
RHeadD & " " & RHeadD1 & " " & RHeadD2
& Chr(10) & ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = "$A:$E"
.LeftMargin = Application.InchesToPoints(0.3)
.RightMargin = Application.InchesToPoints(0.3)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 65
End With
-----Original Message-----
Hi
I have a simple macro in Excel 97:
Sub PrintFormat()
With ActiveSheet.PageSetup
.LeftFooter = "&D&T"
.CenterFooter = "&A"
.RightFooter = "&F"
.PrintGridlines = True
.PaperSize = xlPaperA4
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End Sub
I run this from any worksheet page without selecting a
particular block of cells. The FitToPages instructions at
the end don't work. I intend to be fitting the entire
worksheet contents into an A4 page, as would happen if I
set these options manually in page setup.
I have a feeling I need to specify the area of the
worksheet in which there is data to print. Am I right? How
would I do that?
Advice gratefully received
Steve
.
|