View Single Post
  #1   Report Post  
Reason
 
Posts: n/a
Default 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.