A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Send Email when Outlook Closes



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 23rd 07, 10:56 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default 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!
Ads
  #2  
Old July 24th 07, 07:21 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default 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!

  #3  
Old July 24th 07, 02:26 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default 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!


  #4  
Old July 24th 07, 03:22 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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!



  #5  
Old July 24th 07, 03:42 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default 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!



  #6  
Old July 24th 07, 04:08 PM posted to microsoft.public.outlook.program_vba
Mike
external usenet poster
 
Posts: 332
Default 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!



  #7  
Old July 25th 07, 02:58 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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!"


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forward email closes Word? Penny Miller Outlook - General Queries 0 September 5th 06 07:42 PM
outlook process never closes??? luis Outlook - General Queries 4 April 22nd 06 03:47 PM
Email editor closes when forwarding Excel-embedded email Outlook - General Queries 0 March 18th 06 03:01 PM
Email editor closes when forwarding Excel-embedded email Outlook - Installation 0 March 18th 06 03:01 PM
Outlook closes do to errors every time I send an E-Mail. don Outlook - Installation 0 March 4th 06 06:39 PM


All times are GMT +1. The time now is 08:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.