PageSetup オブジェクト

Microsoft Excel Visual Basic のリファレンス

PageSetup オブジェクト

複数のオブジェクト
PageSetup
Graphic

ページレイアウトの設定全体を表します。PageSetup オブジェクトには、すべてのページ設定属性 (左余白、下余白、用紙サイズなど) が、プロパティとして含まれています。

使い方

PageSetup オブジェクトを取得するには、PageSetup プロパティを使用します。次の使用例は、ワークシートの印刷の向きを横に設定し、印刷します。

With Worksheets("Sheet1")
    .PageSetup.Orientation = xlLandscape
    .PrintOut
End With
		

複数のプロパティを同時に設定するときは、With ステートメントを使うと便利です。次の使用例は、ワークシート 1 のすべての余白を設定します。

With Worksheets(1).PageSetup
    .LeftMargin = Application.InchesToPoints(0.5)
    .RightMargin = Application.InchesToPoints(0.75)
    .TopMargin = Application.InchesToPoints(1.5)
    .BottomMargin = Application.InchesToPoints(1)
    .HeaderMargin = Application.InchesToPoints(0.5)
    .FooterMargin = Application.InchesToPoints(0.5)
End With