XDocuments.Close Method

InfoPath Developer Reference

Closes the specified Microsoft Office InfoPath 2007 form.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.Close(varIndex)

expression   An expression that returns a XDocuments object.

Parameters

Name Required/Optional Data Type Description
varIndex Required Variant The string value that specifies the Uniform Resource Identifier (URI) of a form, a long integer value that specifies the positional index of an XDocument object within the XDocuments collection, or a reference to an XDocument object.

Return Value
Nothing

Remarks

The Close method closes the currently open form without quitting the InfoPath application. The form is closed unconditionally, meaning that any changes made to the data in the form are not saved.

Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Example

In the following example, the Close method of the XDocuments collection is used to close the currently open form using the positional index of an XDocument object contained in the collection:

JScript
  Application.XDocuments.Close(0);

Alternatively, you can pass a reference to an XDocument object:

JScript
  var objXDoc;

objXDoc = Application.XDocuments(0); Application.XDocuments.Close(objXDoc);

See Also