Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding automatic page breaks in new, blank worksheet

When I create a new worksheet, it's blank and there are helpful dotted
lines indicating automatic page breaks. However if I run

debug.print ActiveSheet.HPageBreaks.Count

it returns 0 (same for VPageBreaks). The only way I've found to make
the page breaks "real" is to enter data beyond them. That is, after
typing something in a cell past the first horizontal line,
HPageBreaks.Count=1 (VPageBreaks.Count is still 0 until I enter data
to the right of the first dotted line).

This is a problem because I have written two functions that return the
height and width of a printable page as follows:

Public Function pageHeight() as Double
'Returns height of a printable area
Dim heightRange as String
heightRange = "A1:" & ActiveSheet.HpageBreaks(1).Location.Offset
(-1,0).Address
pageHeight = Range(heightRange).height
End Function

And analogously for width. However, these bust if I haven't
"activated" both the first horizontal and vertical pagebreaks.

Is there any way I can get find those breaks or directly call the
dimensions of that area programatically without fiddling with the
sheet every time?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Finding automatic page breaks in new, blank worksheet

Public Function pageHeight() as Double
If IsEmpty(ActiveSheet.Range("A333") Then
ActiveSheet.Range("A333").Value = "DuckSoup"
End If

'find page breaks

If ActiveSheet.Range("A333").Value = "DuckSoup" Then
ActiveSheet.Range("A333").Clear
End If
End Function
--
Jim Cone
Portland, Oregon USA



"eutocius"
wrote in message
When I create a new worksheet, it's blank and there are helpful dotted
lines indicating automatic page breaks. However if I run

debug.print ActiveSheet.HPageBreaks.Count

it returns 0 (same for VPageBreaks). The only way I've found to make
the page breaks "real" is to enter data beyond them. That is, after
typing something in a cell past the first horizontal line,
HPageBreaks.Count=1 (VPageBreaks.Count is still 0 until I enter data
to the right of the first dotted line).

This is a problem because I have written two functions that return the
height and width of a printable page as follows:

Public Function pageHeight() as Double
'Returns height of a printable area
Dim heightRange as String
heightRange = "A1:" & ActiveSheet.HpageBreaks(1).Location.Offset
(-1,0).Address
pageHeight = Range(heightRange).height
End Function

And analogously for width. However, these bust if I haven't
"activated" both the first horizontal and vertical pagebreaks.

Is there any way I can get find those breaks or directly call the
dimensions of that area programatically without fiddling with the
sheet every time?
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
When automatic page breaks are moved each cell becomes a new page Queso hotmail com> Excel Discussion (Misc queries) 0 March 30th 10 03:08 AM
Automatic page breaks Bob Johnson Excel Discussion (Misc queries) 0 September 28th 06 05:38 PM
Automatic Page Breaks Cici Excel Worksheet Functions 1 June 23rd 06 09:59 PM
Automatic Page Breaks Ron Excel Programming 6 May 5th 06 02:07 PM
Automatic page breaks hijack worksheet br549 Excel Discussion (Misc queries) 4 November 12th 05 01:21 AM


All times are GMT +1. The time now is 05:44 AM.

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"