How to create a button to save form and exit InfoPath?

J

Jaco Leuschner

Hi

I would like to add a button at the end of the form that saves the form and
then exits InfoPath. How can I do this?

Thanks
 
S

Scott Roberts [MSFT]

In the OnClick handler for your button, write script or managed code to save
and the close the form using the InfoPath OM. There are both Save and Quit
methods that will do what you want. However, in both cases, you're form
needs to be fully trusted. More information about this is available in the
InfoPath 2003 SDK. You can access the SDK and more information about
InfoPath from here:
http://msdn.microsoft.com/office/understanding/infopath/default.aspx

- Scott
 
S

Scott L. Heim [MSFT]

Hi,

In order to use a button to save the form and then exit InfoPath, your form
will need to be "fully trusted." For more information on creating Fully
Trusted forms, see the following:

Understanding Fully Trusted Forms
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/
ipsdkUnderstandingFullyTrustedForms.asp

If you have installed Office/InfoPath SP1, you can also create a Fully
Trusted form if you have a code-signing certificate. Regardless of the
method you choose for implementing Full Trust, here is some sample code for
saving the form to the root "C" drive and then exiting InfoPath:

XDocument.SaveAs "C:\FormName.XML"
Application.ActiveWindow.Close False

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top