AddAsk Method

Applies To

MailMergeFields collection object.

Description

Adds an ASK field to a mail merge main document. Returns a MailMergeField object. When updated, an ASK field displays a dialog box that prompts you for text to assign to the specified bookmark.

Syntax

expression.AddAsk(Range, Name, Prompt, DefaultAskText, AskOnce)

expression Required. An expression that returns a MailMergeFields object.

Range Required Range object. The location for the ASK field.

Name Required String. The bookmark name that the response or default text is assigned to. Use a REF field with the bookmark name to display the result in a document.

Prompt Optional Variant. The text that's displayed in the dialog box.

DefaultAskText Optional Variant. The default response, which appears in the text box when the dialog box is displayed. Corresponds to the \d switch for an ASK field.

AskOnce Optional Variant. True to display the dialog box only once instead of each time a new data record is merged. Corresponds to the \o switch for an ASK field.

See Also

AddFillIn method.

Example

This example adds an ASK field at the end of the active mail merge main document.

Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.MailMerge.Fields.AddAsk Range:=myRange, _
    Prompt:="Type your company name", Name:="company", AskOnce:=True
This example adds an ASK field after the last mail merge field in Main.doc.

Set myMMFields = Documents("Main.doc").MailMerge.Fields
myMMFields(myMMFields.Count).Select
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdMove
myMMFields.AddAsk Range:=Selection.Range, Name:="name", _
    Prompt:="What is your name"