Preserving PageBreaks - I believe that Ivan did this once.


Posted by bill on September 06, 2001 10:52 AM

I want to scan a worksheet for pagebreaks.

I'll save them to an array

Next I'll PAGESETUP the sheet with zooming.

This process destroys the Pagebreaks.

I will then loop through the PageBreaks and reset them.

I saw Ivan's reference:

4195.html

which says to use:
ActiveSheet.VPageBreaks.Location.Address

Ideas?

Posted by bill on September 06, 2001 11:50 AM

This code is a monkey muck mucker muck!

I've found this code:

For Each pb in Worksheets(1).HPageBreaks
If pb.Extent = xlPageBreakFull Then
cFull = cFull + 1
Else
cPartial = cPartial + 1
End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
" print-area page breaks"

Yet, how do you define PB????

Posted by Mark O'Brien on September 06, 2001 2:39 PM

Re: This code is a monkey muck mucker muck!

Probably just:

Dim pb as HPageBreak

Posted by Robb on September 07, 2001 4:58 AM

Re: This code is a monkey muck mucker muck!

Bill

I don't think you really need to as it is already defined
in the statement For Each pb in Worksheets(1).HPageBreaks

This indicates that a pb is one of the collection known as PageBreaks,
thus it must be a pagebreak.

Regards



Posted by bill on September 07, 2001 6:45 AM

Dumb and Dumber

It does (as you said) work.

The trick is also to make sure you have data on the page.

IE, it won't find any PB's (as HPageBreak) unless the worksheet has actual data.

Could a sworn I tried the declaration...Thanks for the humility:)