Moving Horizontal PageBreak

C

CptGreenwood

I try to move the location of a horizontal pagebreak (HPageBreak) to a
new location by following statement:

Worksheets("Document").HPageBreaks(1).Location =
Worksheets("Document").Range("A67")

This first pagebreak on the sheet is located at Range("A70") and should
be moved three rows up to Range("A67") by that statement.

It does not work as expected. The effect: The value (!) of A67 is
copied to A70, so both cells have the same text. The pagebreak is not
affected.

What's wrong with the statement I use? It's quite the same as the one
found in online help when searching for "location".
 
L

LtLeary

I tried this a few months back and couldn't do it with the Location method
either (It looks as though it is a read-only property.)

I had to use the delete and add methods to make it work. It didn't work the
"well" as I couldn't tell "programatically" which page break (by range) I
was deleting.

For example

Worksheets("Sheet1").Hpagebreaks(1).delete
Worksheets("Sheet1").Hpagebreaks.Add .Range("A3")

Works
But I couldn't determine that Hpagebreaks(1) was really the pagebreak I
wanted to delete (Other than knowing that my particular app only had one!)


Perhaps someone can straighten both of us out.

Lt

"CptGreenwood" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top