Link to home
Start Free TrialLog in
Avatar of bscmis
bscmis

asked on

NewMail Event not firing

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
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bscmis
bscmis

ASKER

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.
:) thanks for the grade. ...

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