Share via


ExternalApplication.New Method

InfoPath Developer Reference

Creates a new Microsoft Office InfoPath 2007 form based on a specified form.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.New(bstrDocumentURI, dwBehavior)

expression   An expression that returns a ExternalApplication object.

Parameters

Name Required/Optional Data Type Description
bstrDocumentURI Required String The string value that specifies the Uniform Resource Identifier (URI) of a form.
dwBehavior Optional Long Optional Long. Default value is 1. A long value that specifies how the form should be opened. The values are based on the XdDocumentVersionMode enumeration.

Return Value
Nothing

Remarks

The New method can be used to only create a new form based on an existing form; it cannot be used to create a new form based on a form template. To create a form from a form template, use the NewFromSolution method of the ExternalApplication object.

When you use the New method, InfoPath is opened and the new form is ready to be filled out.

Bb229785.vs_note(en-us,office.12).gif  Note
You cannot use the Close method of the ExternalApplication object to close a from that has been opened with the New method. When the New method creates a form, the name of that form is not yet known.

Security Level 3: Can be accessed only by fully trusted forms.

Example

In the following example, which is written in the Visual Basic for Applications (VBA) programming language, the New method of the ExternalApplication object is used to create a new form based on a specified form:

Visual Basic for Applications
  Public Sub CreateFromForm()

Dim objIP As Object

'Create a reference to the ExternalApplication object. Set objIP = CreateObject("InfoPath.ExternalApplication")

'Create an InfoPath form. objIP.New ("C:\My Forms\Form1.xml") MsgBox ("The InfoPath form has been created.")

Set objIP = Nothing

End Sub

See Also