Show All

# NewFromSolution Method (XDocuments Collection)

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

expression.NewFromSolution(ByVal varURI As Variant) As XDocument

expression Required. An expression that returns a reference to the XDocuments collection.

varURI Required Variant. Specifies the Uniform Resource Identifier (URI) of a form.

returns A reference to an XDocument object.

## 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.

## Remarks

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

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

## Example

In the following example, the NewFromSolution method of the XDocuments collection is passed the URI of an existing form template, and a new form is created and its associated XDocument object returned:

    var objXDoc;

    objXDoc = Application.XDocuments.NewFromSolution("C:\\MyForm.xsn");

©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