![]() |
Send Email when Outlook Closes
I am looking for simple code that would send an email with the same
attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
Please search for 'Explorer wrapper'. With that you're able to track when the last Explorer is going to close, that's the time for your e-mail. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 23 Jul 2007 13:56:01 -0700 schrieb Mike: I am looking for simple code that would send an email with the same attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
Not sure what this means at all. I'm not talking about closing an explorer
window, and I am looking for the code to automate sending the email when OUTLOOK closes. In other words, a module within Outlook that will execute when outlook shuts down. Similar to a Auto_Close routine in Excel. "Michael Bauer [MVP - Outlook]" wrote: Please search for 'Explorer wrapper'. With that you're able to track when the last Explorer is going to close, that's the time for your e-mail. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 23 Jul 2007 13:56:01 -0700 schrieb Mike: I am looking for simple code that would send an email with the same attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
By the time you get any event such as Outlook.Quit or even the earlier
Explorer.Close on the last open Explorer, which is what Michael was talking about, it's too late to use Outlook to send an email. You'd have to directly address an SMTP server to send an email or something like that. It'd be way to late to get Outlook to do it. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mike" wrote in message ... Not sure what this means at all. I'm not talking about closing an explorer window, and I am looking for the code to automate sending the email when OUTLOOK closes. In other words, a module within Outlook that will execute when outlook shuts down. Similar to a Auto_Close routine in Excel. "Michael Bauer [MVP - Outlook]" wrote: Please search for 'Explorer wrapper'. With that you're able to track when the last Explorer is going to close, that's the time for your e-mail. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 23 Jul 2007 13:56:01 -0700 schrieb Mike: I am looking for simple code that would send an email with the same attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
This has been done before though. I had it working. The new code I have this
time around is this: Private Sub Application_Quit() Dim oApp As Outlook.Application Dim oMail As Outlook.MailItem Set oApp = CreateObject("Outlook.Application") Set oMail = oApp.CreateItem(olMailItem) Set myAttachments = oMail.Attachments myAttachments.Add "H:\Personal\To Do.doc", olByValue, 1, "Fichier" oMail.To = " oMail.Subject = "To Do List " & Format(Date, "DDD mm/dd/yy") oMail.Send ' oApp.Quit Set oApp = Nothing End Sub The commented out oApp.Quit so that It would send the mail, but now it just stays in my outbox until the next time I open Outlook. "Ken Slovak - [MVP - Outlook]" wrote: By the time you get any event such as Outlook.Quit or even the earlier Explorer.Close on the last open Explorer, which is what Michael was talking about, it's too late to use Outlook to send an email. You'd have to directly address an SMTP server to send an email or something like that. It'd be way to late to get Outlook to do it. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mike" wrote in message ... Not sure what this means at all. I'm not talking about closing an explorer window, and I am looking for the code to automate sending the email when OUTLOOK closes. In other words, a module within Outlook that will execute when outlook shuts down. Similar to a Auto_Close routine in Excel. "Michael Bauer [MVP - Outlook]" wrote: Please search for 'Explorer wrapper'. With that you're able to track when the last Explorer is going to close, that's the time for your e-mail. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 23 Jul 2007 13:56:01 -0700 schrieb Mike: I am looking for simple code that would send an email with the same attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
Actually, this CAN be done. I just added a msgbox at the end so that it would
give Outlook a second to get the message out of the outbox. I used a msgbox that would only display for 2 seconds then close. CreateObject("WScript.Shell").Popup "To-Do List Sent", 2, "Done!" "Mike" wrote: This has been done before though. I had it working. The new code I have this time around is this: Private Sub Application_Quit() Dim oApp As Outlook.Application Dim oMail As Outlook.MailItem Set oApp = CreateObject("Outlook.Application") Set oMail = oApp.CreateItem(olMailItem) Set myAttachments = oMail.Attachments myAttachments.Add "H:\Personal\To Do.doc", olByValue, 1, "Fichier" oMail.To = " oMail.Subject = "To Do List " & Format(Date, "DDD mm/dd/yy") oMail.Send ' oApp.Quit Set oApp = Nothing End Sub The commented out oApp.Quit so that It would send the mail, but now it just stays in my outbox until the next time I open Outlook. "Ken Slovak - [MVP - Outlook]" wrote: By the time you get any event such as Outlook.Quit or even the earlier Explorer.Close on the last open Explorer, which is what Michael was talking about, it's too late to use Outlook to send an email. You'd have to directly address an SMTP server to send an email or something like that. It'd be way to late to get Outlook to do it. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mike" wrote in message ... Not sure what this means at all. I'm not talking about closing an explorer window, and I am looking for the code to automate sending the email when OUTLOOK closes. In other words, a module within Outlook that will execute when outlook shuts down. Similar to a Auto_Close routine in Excel. "Michael Bauer [MVP - Outlook]" wrote: Please search for 'Explorer wrapper'. With that you're able to track when the last Explorer is going to close, that's the time for your e-mail. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 23 Jul 2007 13:56:01 -0700 schrieb Mike: I am looking for simple code that would send an email with the same attachment and subject and recipient everytime I close down Outlook 2003. I did this once before on my old machine, and do not have the code any longer. Thanks! |
Send Email when Outlook Closes
If it works for you great. I wouldn't instantiate an Outlook session inside
the Quit event myself. But that's up to you. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mike" wrote in message ... Actually, this CAN be done. I just added a msgbox at the end so that it would give Outlook a second to get the message out of the outbox. I used a msgbox that would only display for 2 seconds then close. CreateObject("WScript.Shell").Popup "To-Do List Sent", 2, "Done!" |
All times are GMT +1. The time now is 06:15 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com