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
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?
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.