ExternalApplication Object

InfoPath Developer Reference

Represents the Microsoft Office InfoPath 2007 application.

Version Information
 Version Added:  InfoPath 2003

Remarks

The ExternalApplication object implements a limited set of methods that can be used for automating InfoPath by an external Component Object Model (COM)–based programming language.

The ExternalApplication object can be used to perform a limited set of InfoPath operations such as creating, opening, or closing a form; registering or unregistering a form template; or simply quitting the application.

To use the ExternalApplication object, you must first create a reference to it using the ProgID of the InfoPath object model along with the name of the ExternalApplication object. The following example demonstrates creating a reference to the ExternalApplication object using the Visual Basic for Applications (VBA) programming language:

Visual Basic for Applications
  Dim objIP As Object
Set objIP = CreateObject("InfoPath.ExternalApplication")
Bb229855.vs_note(en-us,office.12).gif  Note
This example uses late-binding for creating the reference to the ExternalApplication object; you can also use early-binding by setting a reference to the InfoPath object model in your programming environment.

For more information about using the ExternalApplication object, see Automating InfoPath from an external application.

Example

After you have created a reference to the ExternalApplication object, you can then use the methods that it provides to interact with InfoPath. In the following example, written in VBA, the Open method of the ExternalApplication object is used to open a form based on the specified Uniform Resource Identifier (URI):

Visual Basic for Applications
  Public Sub OpenForm()

Dim objIP As Object

'Create the ExternalApplication object and open a specified form. Set objIP = CreateObject("InfoPath.ExternalApplication") objIP.Open ("C:\My Forms\Form1.xml")

Set objIP = Nothing

End Sub

See Also