XDocuments2.New(Object, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new Microsoft Office InfoPath form based on the specified form.
public Microsoft.Office.Interop.InfoPath.XDocument New (object varURI, int dwBehavior = 1);
abstract member New : obj * int -> Microsoft.Office.Interop.InfoPath.XDocument
Public Function New (varURI As Object, Optional dwBehavior As Integer = 1) As XDocument
Parameters
- varURI
- Object
Specifies the Uniform Resource Identifier (URI) of a form.
- dwBehavior
- Int32
Default value is 1. A value that specifies how the form should be opened. The values are based on the XdDocumentVersionMode enumeration.
Returns
An _XDocument object.
Implements
Examples
In the following example, the New method of the XDocumentsCollection collection is passed the URI of an existing form, and a new form is created and its associated _XDocument object returned:
XDocument newDocument;
newDocument = thisApplication.XDocuments.<span class="label">New</span>(@"C:\MyForm.xml", 1);
Remarks
The New method can only be used to 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(Object) method.
When you use the New method, the new form opens in InfoPath and is ready to be filled out.