Excel 2007 vba: how to access HPageBreaks

I'm trying to write a macro that can look at the list of horizontal page breaks that are stored in a sheet, and it looks like HPageBreaks should be just that. I can add or remove page breaks, but I cannot isolate the collection to see its contents. Even adding hours and viewing ActiveSheet.HPageBreaks just calls a shared object with a field of 0 regardless of existing page breaks.

I am really confused about this now. Is there a way to view existing page breaks in a worksheet? The list of lines that they meet in / between will be large.

+4
source share
1 answer

This should help you:

Sub testing() MsgBox "There are " & ActiveSheet.HPageBreaks.Count & " pagebreaks." For Each pb In ActiveSheet.HPageBreaks MsgBox "a page break lies between rows " & pb.Location.Row - 1 _ & " and " & pb.Location.Row Next End Sub 

Here are some (rather meager) links:

http://msdn.microsoft.com/en-us/library/aa661442(office.10).aspx

http://msdn.microsoft.com/en-us/library/aa206426(office.10).aspx

+3
source

Source: https://habr.com/ru/post/1305488/


All Articles