Show All

# NewFromSolution Method (ExternalApplication Object)

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

expression.NewFromSolution(ByVal bstrSolutionURI As String)

expression Required. 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

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp