View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Page setup VBA help please

I used the macro recorder to give you a quick idea of the properties that
you need to be working with. Basically, you would set the Orientation to a
value (as in the 4 examples below), then fetch the Zoom property (it will
be a Variant from 10 to 400 or False). After getting the Zoom level for
each of your 3 Setups, check to see which one is the largest, then decide
what to do.

The FitToPages properties (FitToPagesWide and FitToPagesTall) can either be
set to a number, or to False. Normally, you set FitToPagesTall to False
(clear the value in the drop-down combo box in the File|Page Setup dialog
box) to enable the worksheet to span multiple pages. This is how I recorded
the SetLandscape1Wide routine below.

'----------------------------------------
Sub SetPortrait1()
With ActiveSheet.Page
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End Sub

'----------------------------------------
Sub SetLandscape1()
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End Sub

'----------------------------------------
Sub SetLandscape1Wide()
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
End With
End Sub

'----------------------------------------
Sub SetZoom()
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Zoom = 75
End With
End Sub

--
Regards,
Bill Renaud