Submit and Close Email Form - InfoPath Dev
in

InfoPath Dev

Submit and Close Email Form

Last post 03-27-2013 02:34 AM by HHearle. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-21-2012 04:07 PM

    Submit and Close Email Form

    I have an infopath form that will be used for a training evaluation.  The form must be setup on one view and then is emailed via Outlook.  The data is submitted to an Access database on a server and everything works fine.  After the Submit button is clicked the form goes to another view which is a Thank You page.  When the person closes the email from the Thank You page there is a message box asking the user if they want to submit, but they have already submitted.  I have tried to use submit and close option on the button, but it doesn't close the form/email (it does submit); my guess is because it is outlook, not infopath open. 

     How can get the form to submit and then have the user close the email without getting a Do you want to Submit message box in Outlook? 

  • 03-27-2013 02:34 AM In reply to

    Re: Submit and Close Email Form

    I know I suggest this for everything but... SendKeys?  This would close the window.

    {
         var WshShell = new ActiveXObject("WScript.Shell");
         WshShell.SendKeys("%fx")
    }

    The sendkeys method works on the active window; I would assume that by switching to outlook as the active window the code would continue to work in Outlook.

     You could submit the form using this simple code instead of your version... what this will do is open a new message in InfoPath to the specified recipient.  You could then add a further line to send it automatically.

    var oEnvelope = Application.ActiveWindow.MailEnvelope;
    oEnvelope.Subject = "yoursubjecthere";
    oEnvelope.To = "[email protected]";
    oEnvelope.Visible = true;

    Then you could use SendKeys:

    var WshShell = new ActiveXObject("Wscript");

    WshShell.SendKeys("%s")

    The overall code would appear as follows:

    { var oEnvelope = Application.ActiveWindow.MailEnvelope; oEnvelope.Subject = "yoursubjecthere"; oEnvelope.To = "[email protected]"; oEnvelope.Visible = true; var WshShell = new ActiveXObject("WScript.Shell");     WshShell.SendKeys("%s") }

    Can I ask why they are asked to submit twice? 

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.