Share via


XDocuments2.Open method (Object, Int32)

Opens the specified Microsoft Office InfoPath form.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
Function Open ( _
    varURI As Object, _
    dwBehavior As Integer _
) As XDocument
'Usage
Dim instance As XDocuments2
Dim varURI As Object
Dim dwBehavior As Integer
Dim returnValue As XDocument

returnValue = instance.Open(varURI, dwBehavior)
XDocument Open(
    Object varURI,
    int dwBehavior
)

Parameters

  • varURI
    Type: System.Object

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

  • dwBehavior
    Type: System.Int32

    Default value is 1. A value that specifies how the form should be opened. The values are based on the XdDocumentVersionMode enumeration.

Return value

Type: Microsoft.Office.Interop.InfoPath.XDocument
An _XDocument object.

Implements

XDocuments.Open(Object, Int32)

Remarks

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

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

Examples

In the following example, the Open method of the XDocumentsCollection collection is passed the URI of an existing form, and the form is opened and its associated _XDocument object returned:

XDocument document;
document = thisApplication.XDocuments.Open(@"C:\MyForm.xml", 1);

See also

Reference

XDocuments2 interface

XDocuments2 members

Open overload

Microsoft.Office.Interop.InfoPath namespace