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.appl ication")
MsgBox "Startup"
End Sub
Private Sub myOlApp_NewMail()
MsgBox "New Mail"
End Sub
Dim WithEvents myOlApp As Outlook.Application
Private Sub Application_Startup()
Set myOlApp = CreateObject("Outlook.appl
MsgBox "Startup"
End Sub
Private Sub myOlApp_NewMail()
MsgBox "New Mail"
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
already thought it would be more then that, cause when i ran it here it worked
http://www.outlookcode.com/
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnolbk02/html/odc_ch11olevents.asp