Ms office 2007 forums

how can i apply same header/footer in more than one word 2007 document file
1 answer Last reply
More about office 2007 forums
  1. 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
Ask a new question

Read More

Office Word 2007 Document Apps