Does anyone know why the following code does not move the first horizontal page break to the specified location?
<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> test()<br><br> <SPAN style="color:#00007F">Set</SPAN> CurrCell = ActiveCell<br> <br> Cells(Rows.Count, Columns.Count).Select<br> <br> ActiveSheet.ResetAllPageBreaks<br> <br> Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")<br><br> CurrCell.Select<br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
It seems to work if I replace...
<font face=Calibri> Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")</FONT>
with
<font face=Calibri>Worksheets(1).HPageBreaks.Add Worksheets(1).Range("e5")</FONT>
So why doesn't it work with the Location property?
Thanks!
<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> test()<br><br> <SPAN style="color:#00007F">Set</SPAN> CurrCell = ActiveCell<br> <br> Cells(Rows.Count, Columns.Count).Select<br> <br> ActiveSheet.ResetAllPageBreaks<br> <br> Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")<br><br> CurrCell.Select<br> <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
It seems to work if I replace...
<font face=Calibri> Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("e5")</FONT>
with
<font face=Calibri>Worksheets(1).HPageBreaks.Add Worksheets(1).Range("e5")</FONT>
So why doesn't it work with the Location property?
Thanks!