Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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.
  #2   Report Post  
Rowan
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a new page break to an existing page break Edward Letendre Excel Discussion (Misc queries) 1 March 6th 05 09:29 AM
Automatic page breaks in Excell 2003 Novice Excel Discussion (Misc queries) 2 February 21st 05 09:59 PM
How do I keep page breaks for each page in a sheet without the co. notexcellent Excel Discussion (Misc queries) 0 February 9th 05 07:53 PM
Page breaks don't show on screen and don't print separately. It i. Peter Excel Discussion (Misc queries) 1 November 29th 04 04:33 PM
How do I stop automatic page breaks in excel Lesley Hutchinson Excel Worksheet Functions 0 October 31st 04 12:49 PM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"