View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jared Jared is offline
external usenet poster
 
Posts: 109
Default Recorded Macro to Set page breaks generates error.

Julie,

This is coppied from the help in Excel 2002:

For the HPageBreak and VPageBreak objects, this property returns or sets the
cell (a Range object) that defines the page-break location. Horizontal page
breaks are aligned with the top edge of the location cell; vertical page
breaks are aligned with the left edge of the location cell. Read/write Range.

Example
This example moves the horizontal page-break location.

Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")


"JulieD" wrote:

Hi Jared

in my version - Help says that HPageBreaks is read-only ...
however, there is a PageBreaks property
and from Help on this property
**
To remove all manual page breaks on a worksheet, set Cells.PageBreak to
xlPageBreakNone.
**

Cheers
JulieD

"Jared" wrote in message
...
Thanks for the help. I have added the page break. I would now like to
delete
all other pagebreaks. The help says that there is a delete method for the
hpagebreaks collection, but I can't get it to work. Any ideas?

"Sharad" wrote:


Hi Jared,

You can use code like below, if you want to add pagebreak after row 30.

Sub pageBreak_Example()
ActiveSheet.ResetAllPageBreaks
ActiveSheet.HPageBreaks.Add Befo=Range("A31")
End Sub

Sharad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!