<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Submit and Close Email Form</title><link>https://www.infopathdev.com:443/forums/thread/88412.aspx</link><pubDate>Wed, 27 Mar 2013 09:34:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:88412</guid><dc:creator>HHearle</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/88412.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=88412</wfw:commentRss><description>&lt;p&gt;I know I suggest this for everything but... SendKeys?&amp;nbsp; This would close the window.&lt;/p&gt;
&lt;p&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var WshShell = new ActiveXObject(&amp;quot;WScript.Shell&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WshShell.SendKeys(&amp;quot;%fx&amp;quot;)&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;You could submit the form using this simple code instead of your version... what this will do is open a new&amp;nbsp;message in InfoPath&amp;nbsp;to the specified recipient.&amp;nbsp; You could then add a further line to send it automatically.&lt;/p&gt;
&lt;p&gt;var oEnvelope = Application.ActiveWindow.MailEnvelope;&lt;br /&gt;oEnvelope.Subject = &amp;quot;yoursubjecthere&amp;quot;;&lt;br /&gt;oEnvelope.To = &amp;quot;&lt;a href="mailto:email@email.com"&gt;email@email.com&lt;/a&gt;&amp;quot;;&lt;br /&gt;oEnvelope.Visible = true;&lt;/p&gt;
&lt;p&gt;Then you could use SendKeys:&lt;/p&gt;
&lt;p&gt;var WshShell = new ActiveXObject(&amp;quot;Wscript&amp;quot;);&lt;/p&gt;
&lt;p&gt;WshShell.SendKeys(&amp;quot;%s&amp;quot;)&lt;/p&gt;
&lt;p&gt;The overall code would appear as follows:&lt;/p&gt;
&lt;p&gt;{ var oEnvelope = Application.ActiveWindow.MailEnvelope; oEnvelope.Subject = &amp;quot;yoursubjecthere&amp;quot;; oEnvelope.To = &amp;quot;email@email.com&amp;quot;; oEnvelope.Visible = true; var WshShell = new ActiveXObject(&amp;quot;WScript.Shell&amp;quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WshShell.SendKeys(&amp;quot;%s&amp;quot;) }&lt;/p&gt;
&lt;p&gt;Can I ask why they are asked to submit twice?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Submit and Close Email Form</title><link>https://www.infopathdev.com:443/forums/thread/81859.aspx</link><pubDate>Tue, 21 Aug 2012 23:07:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81859</guid><dc:creator>samonenate</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81859.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81859</wfw:commentRss><description>&lt;p&gt;I have an infopath form that will be used for a training evaluation.&amp;nbsp; The form must be setup on one view and then is emailed via Outlook.&amp;nbsp; The data is submitted to an Access database on a server and everything works fine.&amp;nbsp; After the Submit button is clicked the form goes to another view which is a Thank You page.&amp;nbsp; 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.&amp;nbsp; I have tried to use submit and close option on the button, but it doesn&amp;#39;t close the form/email (it does submit); my guess is because it is outlook, not infopath open.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;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?&amp;nbsp; &lt;/p&gt;</description></item></channel></rss>