Sign in with
Sign up | Sign in
Your question

Ms office 2007 forums

Last response: in Applications
Share
July 4, 2011 2:02:05 AM

Hello,
how can i apply same header/footer in more than one word 2007 document file

More about : office 2007 forums

July 6, 2011 5:34:53 PM

Not without a script.

The below is an example on how to do it with a current open document. You need to add to it functions to open a document, apply the change, close the document, open a new one, etc...

Placing text into a header or footer
NOTE: The HeaderFooter property requires that the selection be located within a header or footer, or an error will occur.

Sub HeaderFooterProperty()
Dim MyText As String
MyText = "<Replace this with your text>"
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Range.Text = "MyText"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub


The following example changes the text of both the primary header and the primary footer for the first section of the active document.

Sub HeaderFooterObject()
Dim MyText As String
MyHeaderText = "<Replace this with your text>"
MyFooterText = "<Replace this with your text>"
With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = MyHeaderText
.Footers(wdHeaderFooterPrimary).Range.Text = MyFooterText
End With
End Sub
!