View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stevenumber50 Stevenumber50 is offline
external usenet poster
 
Posts: 1
Default Fit to page in macro

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