NewFromSolution Method (ExternalApplication Object)

Creates a new Microsoft Office InfoPath 2003 form based on the specified form template.

expression.NewFromSolution(ByVal bstrSolutionURI As String)

expressionRequired. An expression that returns a reference to the ExternalApplication object.

bstrSolutionURI Required String. The string value that specifies the Uniform Resource Identifier (URI) of a form template.

Security Level

3: Can be accessed only by fully trusted forms.

Remarks

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

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

Note  You cannot use the Close method of the ExternalApplication object to close a from that has been opened with the NewFromSolution method. When the NewFromSolution method creates a form, the name of that form is not yet known.

Example

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

Public Sub CreateFromFormTemplate()

   Dim objIP As Object

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

   'Create an InfoPath form from a form template.
   objIP.NewFromSolution ("C:\My Forms\MyFormTemplate.xsn")
   MsgBox ("The InfoPath form has been created.")

   Set objIP = Nothing

End Sub

Applies to | ExternalApplication Object