印刷位置を中央に設定(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 |
実行結果
関連記事
-
-
Excel を全画面表示(DisplayFullScreen プロパティ)
DisplayFullScreen プロパティ DisplayFullScree …
-
-
印刷設定(フッターに画像を指定)LeftFooterPicture,CenterFooterPicture,RightFooterPicture
フッターに画像を表示するには LeftFooterPicture プロパティ、C …
-
-
ブックを開く(Open メソッド)
ブックを開く(Open メソッド) ブックを開くには、Workbooks コレク …
-
-
印刷時のページの番号付けの方向を設定(PageSetup.Order プロパティ)
PageSetup.Order プロパティ PageSetup.Order プロ …
-
-
ブックの表示・非表示(Visible プロパティ)
ブック表示・非表示(Visible プロパティ) ブック(ウィンドウ)が表示され …
-
-
ユーザー設定のドキュメントプロパティ(CustomDocumentProperties プロパティ)
CustomDocumentProperties プロパティ ユーザー設定のドキ …
-
-
ウィンドウのタイトル(Window.Caption プロパティ)
ウィンドウのタイトル(Caption プロパティ) Windows.Captio …
-
-
スクロール範囲を限定(ScrollArea プロパティ)
ScrollArea プロパティ ScrollArea プロパティ にセル範囲を …
-
-
共有ファイルを開いているユーザー情報を取得(UserStatus プロパティ)
共有ファイルを開いているユーザー情報を取得 UserStatus プロパティは、 …
-
-
印刷のタイトル行、タイトル列を設定(PrintTitleRows,PrintTitleColumns)
PageSetup.PrintTitleRows プロパティ PageSetup …