Muokkaa

Jaa


MailMergeFields.AddFillIn method (Word)

Adds a FILLIN field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression. AddFillIn( _Range_ , _Prompt_ , _DefaultFillInText_ , _AskOnce_ )

expression Required. A variable that represents a 'MailMergeFields' collection.

Parameters

Name Required/Optional Data type Description
Range Required Range object The location for the FILLIN field.
Prompt Optional Variant The text that's displayed in the dialog box.
DefaultFillinText Optional Variant The default response, which appears in the text box when the dialog box is displayed. Corresponds to the \d switch for an FILLIN field.
AskOnce Optional Variant True to display the prompt only once instead of each time a new record is merged. Corresponds to the \o switch for a FILLIN field. The default value is False.

Return value

MailMergeField

Remarks

When updated, a FILLIN field displays a dialog box that prompts you for text to insert into the document at the location of the FILLIN field. Use the Add method with the Fields collection object to add a FILLIN field to a document other than a mail merge main document.

Example

This example adds a FILLIN field that prompts you for a name to insert after "Name:".

With Selection 
 .Collapse Direction:=wdCollapseStart 
 .InsertAfter "Name: " 
 .Collapse Direction:=wdCollapseEnd 
End With 
ActiveDocument.MailMerge.Fields.AddFillin Range:=Selection.Range, _ 
 Prompt:="Your name?", DefaultFillInText:="Joe", AskOnce:=True

See also

MailMergeFields Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.