1 2 3 4 5 6 7 8 9 10 11 12 13
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01039915"><META NAME="lcid" CONTENT="1033"><title>Automating InfoPath</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Automating InfoPath</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><p>Microsoft Office InfoPath 2003 Service Pack 1 offers expanded application automation in the form of methods of the <a href="xdobjApplication.htm" id="HV01021256" lcid=" "><b class="bterm">Application</b></a> object and the <a href="xdcolXDocuments.htm" id="HV01021190" lcid=" "><b class="bterm">XDocuments</b></a> collection. </p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Overview of the Application and XDocument objects</a></p><div id="ExpCol" class="collapsed" border="0"><p>The Application object contains the following methods used for automation:</p><table><tr><th>Method</th><th>Description</th></tr><tr><td><a href="xdmthCacheSolution_1_HV01105346.htm" id="HV01105346" lcid=" "><b class="bterm">CacheSolution</b></a></td><td>Examines the <a href="#" class="glossary" onclick="AppendPopup(this,'xdformtemplate')" onkeypress="AppendPopup(this,'xdformtemplate')">form template</a> in the cache and, if necessary, updates it from the published location of the form template.</td></tr><tr><td><a href="xdmthQuit_1.htm" id="HV01021403" lcid=" "><b class="bterm">Quit</b></a></td><td>Quits the Microsoft Office InfoPath 2003 application.</td></tr><tr><td><a href="xdmthRegisterSolution_1_HV01105348.htm" id="HV01105348" lcid=" "><b class="bterm">RegisterSolution</b></a></td><td>Installs the specified Microsoft Office InfoPath form template.</td></tr><tr><td><a href="xdmthUnregisterSolution_1_HV01105349.htm" id="HV01105349" lcid=" "><b class="bterm">UnregisterSolution</b></a></td><td>Uninstalls the specified Microsoft Office InfoPath 2003 form template.</td></tr></table><p>The <b class="bterm">XDocuments</b> collection contains the following methods that can be used for external automation:</p><table><tr><th>Method</th><th>Description</th></tr><tr><td><a href="xdmthClose_1.htm" id="HV01021380" lcid=" "><b class="bterm">Close</b></a></td><td>Closes the specified Microsoft Office InfoPath 2003 form.</td></tr><tr><td><a href="xdmthNew_2.htm" id="HV01021394" lcid=" "><b class="bterm">New</b></a></td><td>Creates a new Microsoft Office InfoPath 2003 form based on the specified form.</td></tr><tr><td><a href="xdmthNewFromSolution_2.htm" id="HV01021395" lcid=" "><b class="bterm">NewFromSolution</b></a></td><td>Creates a new Microsoft Office InfoPath 2003 form based on the specified form template.</td></tr><tr><td><a href="xdmthNewFromSolutionWithData_HV01103984.htm" id="HV01103984" lcid=" "><b class="bterm">NewFromSolutionWithData</b></a></td><td>Creates a new Microsoft Office InfoPath 2003 form using the specified XML data and form template.</td></tr><tr><td><a href="xdmthOpen_2.htm" id="HV01021396" lcid=" "><b class="bterm">Open</b></a></td><td>Opens the specified Microsoft Office InfoPath 2003 form.</td></tr></table><p><b>Note</b> If the <b class="bterm">Disable Service Pack features</b> option on the <b class="bterm">Advanced</b> tab of the <b class="bterm">Options</b> dialog box in InfoPath is selected, using the methods of the <b class="bterm">Application</b> and <b class="bterm">XDocuments</b> objects will result in an error when the <a href="#" class="glossary" onclick="AppendPopup(this,'ofcomponentobjectmodelcom')" onkeypress="AppendPopup(this,'ofcomponentobjectmodelcom')">Component Object Model (COM)</a> server times out.</p></div><p>For backward compatibility, the automation of InfoPath is accomplished by using the <b class="bterm"><a href="xdobjExternalApplication.htm" id="HV01024618" lcid=" ">ExternalApplication</a></b> object from a programming language or environment that supports the <a href="#" class="glossary" onclick="AppendPopup(this,'ofcomponentobjectmodelcom')" onkeypress="AppendPopup(this,'ofcomponentobjectmodelcom')">Component Object Model (COM)</a>.</p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Overview of the ExternalApplication object</a></p><div id="ExpCol" class="collapsed" border="0"><p>The <b class="bterm">ExternalApplication</b> object provides the following methods that form developers can use to automate InfoPath.</p><table><tr><th>Name</th><th>Description</th></tr><tr><td><b class="bterm"><a href="xdmthCacheSolution.htm" id="HV01040456" lcid=" ">CacheSolution</a></b> method</td><td>Places the specified <a href="#" class="glossary" onclick="AppendPopup(this,'xdformtemplate')" onkeypress="AppendPopup(this,'xdformtemplate')">form template</a> in a cache</td></tr><tr><td><b class="bterm"><a href="xdmthClose_3.htm" id="HV01024988" lcid=" ">Close</a></b> method</td><td>Closes the specified form</td></tr><tr><td><b class="bterm"><a href="xdmthNew_1.htm" id="HV01036661" lcid=" ">New</a></b> method</td><td>Creates a new form based on the specified form</td></tr><tr><td><b class="bterm"><a href="xdmthNewFromSolution_1.htm" id="HV01036664" lcid=" ">NewFromSolution</a></b> method</td><td>Creates a new form based on the specified form template</td></tr><tr><td><b class="bterm"><a href="xdmthOpen_1.htm" id="HV01036666" lcid=" ">Open</a></b> method</td><td>Opens the specified form</td></tr><tr><td><b class="bterm"><a href="xdmthQuit_2.htm" id="HV01036667" lcid=" ">Quit</a></b> method</td><td>Quits the InfoPath application</td></tr><tr><td><b class="bterm"><a href="xdmthRegisterSolution.htm" id="HV01021404" lcid=" ">RegisterSolution</a></b> method</td><td>Installs the specified form template</td></tr><tr><td><b class="bterm"><a href="xdmthUnregisterSolution.htm" id="HV01021423" lcid=" ">UnregisterSolution</a></b> method</td><td>Uninstalls the specified form template</td></tr></table></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Using the ExternalApplication object</a></p><div id="ExpCol" class="collapsed" border="0"><p>To use the <b class="bterm">ExternalApplication</b> object, you must first create a reference to the ProgID of the InfoPath object model along with the name of the <b class="bterm">ExternalApplication</b> object. The following example demonstrates the creation of a reference to the <b class="bterm">ExternalApplication</b> object using the Microsoft <a href="#" class="glossary" onclick="AppendPopup(this,'ofVBA')" onkeypress="AppendPopup(this,'ofVBA')">Visual Basic for Applications (VBA)</a> programming language:</p><pre><code>Dim objIP As Object
Set objIP = CreateObject("InfoPath.ExternalApplication")</code></pre>
<p>After you have created a reference to the <b class="bterm">ExternalApplication</b> object, you can use the methods that it provides to interact with InfoPath. For more information about how the methods of the <b class="bterm">ExternalApplication</b> object are used, click the methods in the preceding table.</p></div><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/inconAutomatingIP_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|