Set off VBA macro on email receipt then that macro accesses the emailcontent

  • Thread starter Thread starter gimme_this_gimme_that
  • Start date Start date
G

gimme_this_gimme_that

Is there a mechanism that allows developers to set off a VBA macro
upon the receipt of every email?

(Sort of like the out-of-office mechanism but evoking a VBA macro
instead of a new email message.)

Also does someone have an example where this is set up and the VBA
macro
accesses the email content of the message that was received?

I'm using Outlook 2003.

Thanks.
 
You can use the ItemAdd event handler for the Items collection of the Inbox
for that.

Search for "zaphtml" at www.outlookcode.com for an example of an ItemAdd
handler that converts all HTML emails into plain text emails.
 
Hi Ken,

The tip you provided lead me on a journey where I ended up installing
Collaboration Data Objects. (Microsoft CDO 1.2.1 Library).

This URL was helpful: http://j-integra.intrinsyc.com/support/kb/article.aspx?id=113792
..

I followed the instructions and forturnately I was able to install
from the network without a CD.

Now....

1. Where is the recommended place to put the code for
Application_Startup() and olInboxItems_ItemAdd() ?

Microsoft Office Outlook Objects ->ThisOutlookSession-> (General
Module)

Or anyplace, such as:

Modules -> Module1

2. When I log out of this account - will the AddItem code turn off?

Thanks.
 
The code goes in the ThisOutlookSession class. The code is running
in-process with Outlook, so if Outlook is closed the code stops.
 
Back
Top