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

x
?
Solved

NewMail Event not firing

Posted on 2003-03-31
4
Medium Priority
?
559 Views
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
0
Comment
Question by:bscmis
  • 3
4 Comments
 
LVL 44

Accepted Solution

by:
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

HAGD:O)Bruintje
0
 

Author Comment

by:bscmis
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.
0
 
LVL 44

Expert Comment

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

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

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