印刷位置を中央に設定(CenterHorizontally, CenterVertically)
PageSetup.CenterHorizontally プロパティ
PageSetup.CenterHorizontally プロパティを使用して、印刷位置を水平方向の中央(余白を除く)に設定することができます。値の取得および設定が可能で、ブール型(Boolean)の値を使用します。
<取得>
object.PageSetup.CenterHorizontally
<設定>
object.PageSetup.CenterHorizontally = boolean
引数・戻り値
- object ・・・ 対象となる Worksheet オブジェクト を指定します。
- boolean ・・・ ブール型(Boolean)の値を指定します。True を指定すると、印刷位置を水平方向の中央(余白を除く)に設定します。
PageSetup.CenterVertically プロパティ
PageSetup.CenterVertically プロパティを使用して、印刷位置を垂直方向の中央(余白を除く)に設定することができます。値の取得および設定が可能で、ブール型(Boolean)の値を使用します。
<取得>
object.PageSetup.CenterVertically
<設定>
object.PageSetup.CenterVertically = boolean
引数・戻り値
- object ・・・ 対象となる Worksheet オブジェクト を指定します。
- boolean ・・・ ブール型(Boolean)の値を指定します。True を指定すると、印刷位置を垂直方向の中央(余白を除く)に設定します。
CenterHorizontally プロパティ・CenterVertically プロパティ 使用例
サンプルVBAソース
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Sub Sample_Center() Dim w As Worksheet Set w = ActiveSheet '用紙の中央(余白除く)に印刷するように設定 w.PageSetup.CenterHorizontally = True w.PageSetup.CenterVertically = True '印刷プレビューを表示 w.PrintPreview End Sub |
実行結果
関連記事
-
-
ブックが互換モードで開いているか確認する(Excel8CompatibilityMode プロパティ)
ブックが互換モードで開いているか確認する Excel8Compatibility …
-
-
ブックの変更が保存されているかを確認する(Saved プロパティ)
ブックの変更が保存されているかを確認する(Saved プロパティ) Saved …
-
-
ワークシートをファイルに保存する(SaveAs メソッド)
SaveAs メソッド ワークシートを名前を付けてファイルに保存します。Work …
-
-
ウィンドウのタイトル(Window.Caption プロパティ)
ウィンドウのタイトル(Caption プロパティ) Windows.Captio …
-
-
PDF または XPS 形式で出力(ExportAsFixedFormat メソッド)
ExportAsFixedFormat メソッド ブックやシートの内容を PDF …
-
-
表示されているセル範囲を取得(VisibleRange プロパティ)
VisibleRange プロパティ 現在表示されているセル範囲(Range オ …
-
-
ワークシートの非表示・再表示(Visible プロパティ)
ワークシートの表示・非表示 ワークシートを非表示にしたり、非表示にしたワークシー …
-
-
ユーザー設定のビュー(CustomView オブジェクト)
ユーザー設定のビュー CustomView オブジェクトは、登録されている各ビュ …
-
-
印刷範囲の設定・解除(PageSetup.PrintArea プロパティ)
PageSetup.PrintArea プロパティ 印刷範囲を設定するには、Pa …
-
-
印刷のタイトル行、タイトル列を設定(PrintTitleRows,PrintTitleColumns)
PageSetup.PrintTitleRows プロパティ PageSetup …
