Page Break Assistance

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Page Break Assistance

Post by ABabeNChrist »

I have a worksheet that is used for inspecting different types of appliances. There are 15 possible choices to choose from that are hidden (rows). When I first begin my inspection I would then select appliances that are available for my inspection using a checkbox to unhide that preferred selected row and the remaining possible choices would still remain hidden. Of course with each inspection the selections will vary, thus causing this portion of report to vary in size, from printing 1 sheet to printing 5 sheets. My problem is I have to reset the Page Break Preview almost every time, because the spacing between pages can vary with the various selections I may choose.

I was trying to record a macro to give me some kind of idea how to reset the Page Break via code. It didn’t really help. What I have been doing to reset the page break was opening Page Break Preview and dragging page 1 all the way to the bottom of print area eliminating all other pages, then I would run this piece of code below that would reset the margin and zoom after which it resets the page correctly. Do you know of a piece of code that might assist me with this dilemma?

Code: Select all

    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(0.1)
        .RightMargin = Application.InchesToPoints(0.1)
        .TopMargin = Application.InchesToPoints(0.25)
        .BottomMargin = Application.InchesToPoints(0.5)
        .HeaderMargin = Application.InchesToPoints(0.3)
        .FooterMargin = Application.InchesToPoints(0.3)
        .CenterHorizontally = True
        .CenterVertically = False
        .Zoom = 68
    End With

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Page Break Assistance

Post by Don Wells »

Did you try:     ActiveSheet.ResetAllPageBreaks ?
Regards
Don

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Page Break Assistance

Post by ABabeNChrist »

No I have not
Thanks Don, let me give it a try.

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Page Break Assistance

Post by ABabeNChrist »

Thanks Don
It works great
That’s what I was looking for…..
One last question, I was adapting your suggestion to my code for setting my margins, where should it be best applied in the beginning of the code or at the end or does it even matter.

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Page Break Assistance

Post by Don Wells »

Putting it in the middle would be ugly; otherwise it could go anywhere before the print activity.
Regards
Don

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Page Break Assistance

Post by ABabeNChrist »

Thank Don :grin: