Home |
Search |
Today's Posts |
#1
|
|||
|
|||
find automatic page breaks
This code does not work when I try to locate automatic page breaks.
Dim i As Integer, BreakType As Integer BreakType = ActiveCell.EntireRow.PageBreak If BreakType = xlAutomatic Or BreakType = xlPageBreakAutomatic Then MsgBox "There is an automatic page break above this row" ElseIf BreakType = xlManual Or BreakType = xlPageBreakManual Then MsgBox "There is a manual page break above this row" ElseIf BreakType = xlNone Or BreakType = xlPageBreakNone Then MsgBox "There is no page break above this row" Else MsgBox "What!?" End If The reason for the redundant Excel constants is just the result of my grasping at straws. I've been online for over four hours now looking for solutions to this problem - no matter where I place the cursor, BreakType returns -4142 (none), even when I place it on clearly displayed page breaks, both manual and automatic. Is there some little-known issue with the PageBreak function? I'm... just... I don't know. Anybody with some input... please feel free. I'm using Excel on the MS Office Suite 2003. |
#2
|
|||
|
|||
I copied your code exactly into XL2002 SP2 on Windows 2000 Pro.
On a blank worksheet I got the same results as you - no page breaks found. As soon as I populated any cell just above or below the pagebreak the code worked as expected. It would appear that if there is nothing to print then the pagebreak is "ignored". Hope this helps Rowan "Reason" wrote: This code does not work when I try to locate automatic page breaks. Dim i As Integer, BreakType As Integer BreakType = ActiveCell.EntireRow.PageBreak If BreakType = xlAutomatic Or BreakType = xlPageBreakAutomatic Then MsgBox "There is an automatic page break above this row" ElseIf BreakType = xlManual Or BreakType = xlPageBreakManual Then MsgBox "There is a manual page break above this row" ElseIf BreakType = xlNone Or BreakType = xlPageBreakNone Then MsgBox "There is no page break above this row" Else MsgBox "What!?" End If The reason for the redundant Excel constants is just the result of my grasping at straws. I've been online for over four hours now looking for solutions to this problem - no matter where I place the cursor, BreakType returns -4142 (none), even when I place it on clearly displayed page breaks, both manual and automatic. Is there some little-known issue with the PageBreak function? I'm... just... I don't know. Anybody with some input... please feel free. I'm using Excel on the MS Office Suite 2003. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
adding a new page break to an existing page break | Excel Discussion (Misc queries) | |||
Automatic page breaks in Excell 2003 | Excel Discussion (Misc queries) | |||
How do I keep page breaks for each page in a sheet without the co. | Excel Discussion (Misc queries) | |||
Page breaks don't show on screen and don't print separately. It i. | Excel Discussion (Misc queries) | |||
How do I stop automatic page breaks in excel | Excel Worksheet Functions |