PC Review


Reply
Thread Tools Rate Thread

how can I count the vertical pages of a print job?

 
 
=?Utf-8?B?UnViYmxl?=
Guest
Posts: n/a
 
      19th Mar 2007
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 !!
 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      19th Mar 2007
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" <(E-Mail Removed)> wrote in message news:7F49AA9D-6746-44A0-A167-(E-Mail Removed)...
>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 !!

 
Reply With Quote
 
=?Utf-8?B?UnViYmxl?=
Guest
Posts: n/a
 
      19th Mar 2007
Hi Ron --

Thank you for your reply -- I am using landscape for my page setup; however,
even with the code you provided it is not working properly -- my sheet goes
down to 45% zoom on my test file even though I can go up to 57% without any
vertical page-breaks.

Do you know if I am even trying the correct type of coding when I do the
VPageBreaks.Count? It acts pretty unstable when I watch the
VPageBreaks.Count when I step through the code.

Thanks Again ...

"Ron de Bruin" wrote:

> 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" <(E-Mail Removed)> wrote in message news:7F49AA9D-6746-44A0-A167-(E-Mail Removed)...
> >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 !!

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      19th Mar 2007
Here is code that I use for the HPageBreaks
http://www.rondebruin.nl/hpagebreaks.htm

Maybe you can use some code of it

--

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


"Rubble" <(E-Mail Removed)> wrote in message news:7D03CD68-769A-4262-8A3E-(E-Mail Removed)...
> Hi Ron --
>
> Thank you for your reply -- I am using landscape for my page setup; however,
> even with the code you provided it is not working properly -- my sheet goes
> down to 45% zoom on my test file even though I can go up to 57% without any
> vertical page-breaks.
>
> Do you know if I am even trying the correct type of coding when I do the
> VPageBreaks.Count? It acts pretty unstable when I watch the
> VPageBreaks.Count when I step through the code.
>
> Thanks Again ...
>
> "Ron de Bruin" wrote:
>
>> 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" <(E-Mail Removed)> wrote in message news:7F49AA9D-6746-44A0-A167-(E-Mail Removed)...
>> >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 !!

>>

 
Reply With Quote
 
=?Utf-8?B?UnViYmxl?=
Guest
Posts: n/a
 
      20th Mar 2007
Thank you !!! The problem I was having with the vpagebreak was that it
didn't "refresh" the count when I changed the zoom properties -- so after
looking at the code you sent over and after going back over your original
comment about running pagesetup.xlLandscape I decided that when I changed the
zoom I would also tell it to make sure it was landscape and apparently that
is enough to cause the vpagebreaks.count to refresh.

So, it now works !!

Thank you for your responses !!!

Jim

"Ron de Bruin" wrote:

> Here is code that I use for the HPageBreaks
> http://www.rondebruin.nl/hpagebreaks.htm
>
> Maybe you can use some code of it
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Rubble" <(E-Mail Removed)> wrote in message news:7D03CD68-769A-4262-8A3E-(E-Mail Removed)...
> > Hi Ron --
> >
> > Thank you for your reply -- I am using landscape for my page setup; however,
> > even with the code you provided it is not working properly -- my sheet goes
> > down to 45% zoom on my test file even though I can go up to 57% without any
> > vertical page-breaks.
> >
> > Do you know if I am even trying the correct type of coding when I do the
> > VPageBreaks.Count? It acts pretty unstable when I watch the
> > VPageBreaks.Count when I step through the code.
> >
> > Thanks Again ...
> >
> > "Ron de Bruin" wrote:
> >
> >> 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" <(E-Mail Removed)> wrote in message news:7F49AA9D-6746-44A0-A167-(E-Mail Removed)...
> >> >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 !!
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Print Pages 1 to 5 with "5" being a reference to a =count Analyst1 Microsoft Excel Programming 0 29th Apr 2009 10:15 PM
can you print labels with vertical numbers - print sideways? =?Utf-8?B?TUpLTUNJVw==?= Microsoft Word Document Management 1 22nd Jun 2007 08:45 PM
How do I not print or count pages? Excel97 =?Utf-8?B?Um9va2llIDFzdCBjbGFzcw==?= Microsoft Excel Programming 5 16th Nov 2005 09:09 AM
Vertical Line on new pages how to get rid of. =?Utf-8?B?Q2hhcmxlcw==?= Microsoft Word Document Management 1 29th Oct 2004 06:20 PM
vertical scroll bar pages 2 at a time! mike Windows XP Internet Explorer 4 12th Feb 2004 11:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:38 PM.