チョト リアルで呼び出しを受けたので、やりかけをコメントで失礼します。
.Headers を 探ると
Sub aaa()
'ヘルプより、テスト データのセット
With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With
End Sub
Sub bbb()
'値がほしいので、逆に取り出す
MsgBox "ヘッダー" & ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text
MsgBox "フッター" & ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text
End Sub
コメント(3件)
.Headers を 探ると
Sub aaa()
'ヘルプより、テスト データのセット
With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With
End Sub
Sub bbb()
'値がほしいので、逆に取り出す
MsgBox "ヘッダー" & ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text
MsgBox "フッター" & ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text
End Sub
で、テストできたので、何かの参考となれば。
※ヘッダー・フッターを勘違いしてたらすみません。
あっ、WSHでしたね、
? wdHeaderFooterPrimary
1
なので、
Const wdHeaderFooterPrimary = 1
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text
で使ってみてください。
ヤバイ、行かなきゃ。
http://d.hatena.ne.jp/garyo/20110602/p2
完成されたみたいで、よかったです。
※リニューアルされて、ウォッチリストに行きにくくなったのと ボケてて回答忘れてました。