Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Outlook COM Add-in: Application_NewMailEx  not getting fired

Posted on 2009-04-01
3
Medium Priority
?
907 Views
Last Modified: 2012-05-06
I noticed that Application_NewMailEx is not getting called on new mail arrieved. Do I need to set any object for this event as well as we did it in objMailItem_Send in http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24253844.html?

Thanks.
0
Comment
Question by:deshaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 24037871
Hi, deshaw.

Yes, objects ALWAYS have to be initialized before they can process events.  Application_NewMailEx will work fine in Outlook without you doing anything because Application refers to an intrinsic object in Outlook.  But, add-ins don't have the application object by default.  Your add-in code has to create an instance and initialize it.  Since you are using that add-in template, I believe it has done the work for you.  Does it contain a line something like

    Dim WithEvents objApp As Outlook.Application

If so, then to trap the NewMailEx event you simply need to modify your code to read

    Sub objApp_NewMailEx

instead of
    Sub Application_NewMailEx

In this case objApp is your add-in's instance of the application object.  Does that make sense?
0
 
LVL 1

Author Closing Comment

by:deshaw
ID: 31565249
thanks. that works perfectly.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24038110
You're welcome.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

636 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