View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default how can I count the vertical pages of a print job?

Hi Rubble

I am trying to write some code where I am trying to stay within the one page
width by however many pages long.


Maybe this will help

Maybe change this line ?
.Orientation = xlLandscape

Sub tester()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.Orientation = xlLandscape
End With
Next sh
End Sub

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Rubble" wrote in message ...
I am trying to write some code where I am trying to stay within the one page
width by however many pages long. I don't like Excel's automatic page set-up
because sometimes it doesn't maximize the printed page space so I have done
the following ...

i = 10
ActiveSheet.DisplayAutomaticPageBreaks = True
ActiveSheet.PageSetup.Zoom = i
'keep going up til 1 then drop back down one
Do Until ActiveSheet.VPageBreaks.Count = 1
i = i + 1
ActiveSheet.PageSetup.Zoom = i
Loop
i = i - 1
ActiveSheet.DisplayAutomaticPageBreaks = False

Do you have any ideas as to why my code doesn't work? It appears I am not
using the vpagebreaks properly ... any ideas .... ?

Thank you !!