EditHeaderSource Method

Microsoft Word Visual Basic

EditHeaderSource Method

       

Opens the header source attached to a mail merge main document, or activates the header source if it's already open.

Note   If the mail merge main document doesn't have a header source, this method causes an error.

expression.EditHeaderSource

expression   Required. An expression that returns a MailMerge object.

Example

This example attaches a header source to the active document and then opens the header source.

With ActiveDocument.MailMerge
    .MainDocumentType = wdFormLetters
    .OpenHeaderSource Name:="C:\Documents\Header.doc"
    .EditHeaderSource
End With

This example opens the header source if the active document has an associated header file attached to it.

Dim mmTemp As MailMerge

Set mmTemp = ActiveDocument.MailMerge
If mmTemp.State = wdMainAndSourceAndHeader Or _
        mmTemp.State = wdMainAndHeader Then
    mmTemp.EditHeaderSource
End If