Share via


ExternalApplication.Quit Method

InfoPath Developer Reference

Quits the Microsoft Office InfoPath 2007 application.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.Quit

expression   An expression that returns a ExternalApplication object.

Return Value
Nothing

Remarks

If you use the Close method of the ExternalApplication object before using the Quit method, data that has been changed in the form will not be saved, nor will users be prompted to save it. However, if you do not use the Close method but only use the Quit method, users will be prompted to save the form before quitting the InfoPath application.

Security Level 3: Can be accessed only by fully trusted forms.

Example

In the following example, which is written in the Visual Basic for Applications (VBA) programming language, the Quit method of the ExternalApplication object is used to quit the InfoPath application:

Visual Basic for Applications
  Public Sub AutomateInfoPathForm()

Dim objIP As Object

'Create a reference to the ExternalApplication object. Set objIP = CreateObject("InfoPath.ExternalApplication")

'Open an InfoPath form. objIP.Open ("C:\My Forms\Form1.xml") MsgBox ("The InfoPath form has been opened.")

'Close the InfoPath form. objIP.Close ("C:\My Forms\Form1.xml") MsgBox ("The InfoPath form has been closed.")

'Quit the InfoPath application. objIP.Quit MsgBox ("The InfoPath application has been closed.")

Set objIP = Nothing

End Sub

See Also