xlpagebreak Property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I use this property to find the address of automatic page breaks? Excel VBA help doesn't do a great job explaining this one

-Kerry
 
Kerry,

Sub test()
Dim hpb As HPageBreak

For Each hpb In Sheet1.HPageBreaks
If hpb.Type = xlPageBreakAutomatic Then
Debug.Print "Automatic: " & hpb.Location.Address
ElseIf hpb.Type = xlPageBreakManual Then
Debug.Print "Manual: " & hpb.Location.Address
End If
Next
End Sub



Rob

Kerry said:
How do I use this property to find the address of automatic page breaks?
Excel VBA help doesn't do a great job explaining this one.
 
Kerry,

The Location property of the H/VPageBreak objects returns a Range
object reference to the location of the page break. From that,
you can use the Address property to get the address. The range
returned by Location is immediately below the page break.

Debug.Print ActiveSheet.HPageBreaks(1).Location.Address


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


Kerry said:
How do I use this property to find the address of automatic
page breaks? Excel VBA help doesn't do a great job explaining
this one.
 
Back
Top