Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


NewMail Event not firing

Posted on 2003-03-31
Medium Priority
Last Modified: 2008-03-10
I cannot get the Startup or NewMail events to fire when Outlook opens or receives new mail. I have the following code in "ThisOutlookSession":

Dim WithEvents myOlApp As Outlook.Application

Private Sub Application_Startup()
   Set myOlApp = CreateObject("Outlook.application")
   MsgBox "Startup"
End Sub

Private Sub myOlApp_NewMail()
    MsgBox "New Mail"
End Sub
Question by:bscmis
  • 3
LVL 44

Accepted Solution

bruintje earned 2000 total points
ID: 8241448
Hello bscmis,

you could try

Private Sub Application_NewMail()
     MsgBox "New Mail"
End Sub

that's all you need to get started, the application object is created with the startup of outlook and because you use it in the thisoutlooksession object the newmail event is triggered by the current application object in the session


Author Comment

ID: 8246181
Thanks bruintje!

I have other code that is more complex and I wanted to simplify it for this question. I was originally using Application_NewMail but I also had code in the general declarations section which seems to have been the culprit.

Once I took out that code it worked like a charm. I hate stuff like that never thought that would have been the problem.
LVL 44

Expert Comment

ID: 8247227
:) thanks for the grade. ...

already thought it would be more then that, cause when i ran it here it worked

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
As a Microsoft Exchange user, you must have known the importance of an Offline storage table (OST) file. It is nothing new for an Outlook user to be dependent on a .ost file during a server break down or a problematic Internet connection. In such a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question