Show All

# Quit Method (ExternalApplication Object)

Quits the Microsoft Office InfoPath 2003 application.

expression.Quit

expression Required. An expression that returns a reference to the ExternalApplication object.

## Security Level

3: Can be accessed only by fully trusted forms.

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

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

    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

©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