Vince
Vince

Reputation: 15146

Changing PrintArea page size using VBA

When the PrintArea consumes more than 1 page, you can adjust the page size ratio in Page Break View via the dashed line in the picture below:

enter image description here

Is there a way to adjust the size ratio using VBA? I couldn't find any properties exposed by PageSetup that allows this.

Upvotes: 0

Views: 189

Answers (1)

Werrf
Werrf

Reputation: 1148

You can use the HPageBreaks.add method to create a new page break in a given location. For example:

Sub PageBreaks()
    Dim shtSheet As Worksheet

    Set shtSheet = ActiveSheet

    shtSheet.HPageBreaks.Add before:=Range("A10")
End Sub

Upvotes: 1

Related Questions