Show All

# OnAfterImport Event

Occurs after the import (or merge) operation has successfully completed.

Function XDocument::OnAfterImport(ByRef pEvent As DocEvent)

pEvent Required DocEvent. A reference to the DocEvent object.

## Remarks

This event handler does not allow users to cancel an operation.

If the merge operation includes merging multiple forms, the OnAfterImport event occurs only after all forms have been merged and the complete operation is successful.

Note The OnAfterImport event handler cannot be created using Microsoft Office InfoPath 2003 design mode; it must be created manually.

Creating the OnAfterImport event handler

To create the OnAfterImport event handler, you must add the OnAfterImport event handler declaration to the form's primary scripting file. Open Microsoft Script Editor (MSE) and enter the following event handler declaration:

JScript syntax

    function XDocument::OnAfterImport(eventObj)
    {
       // Write your code here.
    }

VBScript syntax

    Sub XDocument_OnAfterImport(eventObj)
       ' Write your code here.
    End Sub

## Example

In the following example, the OnAfterImport event handler is used to display a message box that informs the user that the merge operation completed successfully:

    function XDocument::OnAfterImport(eventObj)
    {
       XDocument.UI.Alert("Merge operation was successful.")
    }

©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