Class VPageBreaks (Excel VBA)

A collection of vertical page breaks within the print area. To use a VPageBreaks class variable it first needs to be instantiated, for example

For Each

Here is an example of processing the VPageBreaks items in a collection.


Dim shts As Sheets: Set shts = 
Dim vpgbr As VPageBreak
For Each vpgbr In shts.VPageBreaks
	With vpgbr
		
	End With
Next vpgbr

Add

Adds a vertical page break.

Add (Before)

Before: A Range object. The range to the left of which the new page break will be added.


With Worksheets(1) 
 .HPageBreaks.Add .Range("F25") 
 .VPageBreaks.Add .Range("F25") 
End With

Count

Returns a Long value that represents the number of objects in the collection.


Dim vpbs As VPageBreaks: Set vpbs = 
Dim lngCount As Long
lngCount = vpbs.Count

Item

Returns a single VPageBreak object from the collection.

Item (Index)

Index: The index number of the object.


Dim vpbs As VPageBreaks: Set vpbs = 
Dim vpgbrItem As VPageBreak
Set vpgbrItem = vpbs(Index:=1)