ヘッダとフッタに各種情報を入力する。
Set wordApp = CreateObject("Word.Application") wordApp.Visible = True Set wordDoc = WordApp.Documents.Add() wordDoc.ActiveWindow.ActivePane.View.SeekView = 9 wordApp.Selection.Tables.Add wordApp.Selection.Range,2,2 Set objTable = wordApp.Selection.Tables(1) objTable.Columns(1).Cells.Width = 318 objTable.Columns(2).Cells.Width = 120 objTable.Cell(1,1).Range.Text = "Header1-1" objTable.Cell(1,2).Range.Text = "Header1-2" objTable.Cell(2,1).Range.Text = "Header2-1" objTable.Cell(2,2).Range.Text = "Header2-2" objTable.Cell(1,2).Range.ParagraphFormat.Alignment = 2 objTable.Cell(2,2).Range.ParagraphFormat.Alignment = 2 Set objSection = wordDoc.Sections(1) Set objFooters = objSection.Footers(1).PageNumbers objFooters.Add(1) wordDoc.ActiveWindow.ActivePane.View.SeekView = 0文書新規作成なら3行目で終了w
ヘッダに2行2列の表を挿入し、それぞれのセルに情報を入力。
フッタはセンターにページ番号を表示。
ヘッダとフッタの設定方法が違うのは参照元が違うから・・・。
SeekViewの値は定数。最後に本文に移動させている。