MailMerge.OpenHeaderSource Method

Attaches a mail merge header source to the specified document.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Sub OpenHeaderSource ( _
    Name As String, _
    ByRef Format As Object, _
    ByRef ConfirmConversions As Object, _
    ByRef ReadOnly As Object, _
    ByRef AddToRecentFiles As Object, _
    ByRef PasswordDocument As Object, _
    ByRef PasswordTemplate As Object, _
    ByRef Revert As Object, _
    ByRef WritePasswordDocument As Object, _
    ByRef WritePasswordTemplate As Object, _
    ByRef OpenExclusive As Object _
)
'Usage
Dim instance As MailMerge
Dim Name As String
Dim Format As Object
Dim ConfirmConversions As Object
Dim ReadOnly As Object
Dim AddToRecentFiles As Object
Dim PasswordDocument As Object
Dim PasswordTemplate As Object
Dim Revert As Object
Dim WritePasswordDocument As Object
Dim WritePasswordTemplate As Object
Dim OpenExclusive As Object

instance.OpenHeaderSource(Name, Format, _
    ConfirmConversions, ReadOnly, AddToRecentFiles, _
    PasswordDocument, PasswordTemplate, _
    Revert, WritePasswordDocument, WritePasswordTemplate, _
    OpenExclusive)
void OpenHeaderSource(
    string Name,
    ref Object Format,
    ref Object ConfirmConversions,
    ref Object ReadOnly,
    ref Object AddToRecentFiles,
    ref Object PasswordDocument,
    ref Object PasswordTemplate,
    ref Object Revert,
    ref Object WritePasswordDocument,
    ref Object WritePasswordTemplate,
    ref Object OpenExclusive
)

Parameters

  • Name
    Type: System.String
    Required String. The file name of the header source.
  • Format
    Type: System.Object%
    Optional Object. The file converter used to open the document. Can be one of the WdOpenFormat constants. To specify an external file format, use the OpenFormat property with a FileConverter object to determine the value to use with this argument.
    WdOpenFormat can be one of the following constants:
    wdOpenFormatAllWord
    wdOpenFormatAuto Default.
    wdOpenFormatDocument
    wdOpenFormatEncodedText
    wdOpenFormatRTF
    wdOpenFormatTemplate
    wdOpenFormatText
    wdOpenFormatUnicodeText
    wdOpenFormatWebPages
    wdOpenFormatXML
  • ConfirmConversions
    Type: System.Object%
    Optional Object. True to display the Convert File dialog box if the file isn't in Microsoft Word format.
  • ReadOnly
    Type: System.Object%
    Optional Object. True to open the header source on a read-only basis.
  • AddToRecentFiles
    Type: System.Object%
    Optional Object. True to add the file name to the list of recently used files at the bottom of the File menu.
  • PasswordDocument
    Type: System.Object%
    Optional Object. The password required to open the header source document. (See Remarks below.)
  • PasswordTemplate
    Type: System.Object%
    Optional Object. The password required to open the header source template. (See Remarks below.)
  • Revert
    Type: System.Object%
    Optional Object. Controls what happens if Name is the file name of an open document. True to discard any unsaved changes to the open document and reopen the file; False to activate the open document.
  • WritePasswordDocument
    Type: System.Object%
    Optional Object. The password required to save changes to the document data source. (See Remarks below.)
  • WritePasswordTemplate
    Type: System.Object%
    Optional Object. The password required to save changes to the template data source. (See Remarks below.)
  • OpenExclusive
    Type: System.Object%
    Optional Object. True to open exclusively.

Remarks

When a header source is attached, the first record in the header source is used in place of the header record in the data source.

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

See Also

Reference

MailMerge Interface

MailMerge Members

Microsoft.Office.Interop.Word Namespace