Send an email message everytime outlook starts

G

Guest

How can I use Outlook to automatically send an email message to a fixed
addressee every time the Outlook application is started?
 
S

Sue Mosher [MVP-Outlook]

Are you up to writing a little Outlook VBA code? That's what would be required.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Sue: Thanks for your message. Do I need both of these books to write the
VBA code or is this specific question answered in one of them?

Thanks,
Jack
 
S

Sue Mosher [MVP-Outlook]

Neither. I just hesitate to mention code since most people aren't interested in writing or understanding it. But your scenario is trivial. This code would go into the built-in ThisOutlookSession module:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
With msg
.To = "(e-mail address removed)"
.Subject = "Outlook Startup Message"
.Body = "Outlook started at " & Now()
.Send
End With
End Sub

For Outlook VBA basics, see http://www.outlookcode.com/d/vbabasics.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Sue: I added the following code to the ThisOutlookSession module in the VB
editor within Outlook:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
With msg
.To = "(e-mail address removed)"
.Subject = "Test Info Message "
.Body = "Outlook started at " & Now()
.Send
End With
End Sub


I noticed that file Project1.OTM was saved in my ...Application
Data\Microsoft\Outlook directory. I took the "File\Close and return to
Outlook" option in the VB editor, then closed then restarted Outlook but no
email was generated.

Got any suggestions for where I might look for a problem?

Thanks,
Jack Gombola
 
S

Sue Mosher [MVP-Outlook]

Does any other VBA code run? Did you check your setting under Tools | Macro | Security?

See http://www.outlookcode.com/d/vbabasics.htm for other VBA basics.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Sue: Thanks for your reply. I forgot about the Security level. It was
preventing the code from running. Thanks very much for your help.

Jack Gombola
 

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