MailMerge.OpenHeaderSource Method

Definition

Attaches a mail merge header source to the specified document.

public 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);
abstract member OpenHeaderSource : string * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub OpenHeaderSource (Name As String, Optional ByRef Format As Object, Optional ByRef ConfirmConversions As Object, Optional ByRef ReadOnly As Object, Optional ByRef AddToRecentFiles As Object, Optional ByRef PasswordDocument As Object, Optional ByRef PasswordTemplate As Object, Optional ByRef Revert As Object, Optional ByRef WritePasswordDocument As Object, Optional ByRef WritePasswordTemplate As Object, Optional ByRef OpenExclusive As Object)

Parameters

Name
String

Required String. The file name of the header source.

Format
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:wdOpenFormatAllWordwdOpenFormatAuto Default.wdOpenFormatDocumentwdOpenFormatEncodedTextwdOpenFormatRTFwdOpenFormatTemplatewdOpenFormatTextwdOpenFormatUnicodeTextwdOpenFormatWebPageswdOpenFormatXML

ConfirmConversions
Object

Optional Object. True to display the Convert File dialog box if the file isn't in Microsoft Word format.

ReadOnly
Object

Optional Object. True to open the header source on a read-only basis.

AddToRecentFiles
Object

Optional Object. True to add the file name to the list of recently used files at the bottom of the File menu.

PasswordDocument
Object

Optional Object. The password required to open the header source document. (See Remarks below.)

PasswordTemplate
Object

Optional Object. The password required to open the header source template. (See Remarks below.)

Revert
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
Object

Optional Object. The password required to save changes to the document data source. (See Remarks below.)

WritePasswordTemplate
Object

Optional Object. The password required to save changes to the template data source. (See Remarks below.)

OpenExclusive
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.

Applies to