Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Set off VBA macro on email receipt then that macro accesses the emailcontent (http://www.outlookbanter.com/outlook-vba/85653-set-off-vba-macro-email.html)

[email protected] February 4th 09 07:51 PM

Set off VBA macro on email receipt then that macro accesses the emailcontent
 
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.

Ken Slovak - [MVP - Outlook] February 4th 09 09:11 PM

Set off VBA macro on email receipt then that macro accesses the email content
 
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
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.



[email protected] February 4th 09 11:46 PM

Set off VBA macro on email receipt then that macro accesses theemail content
 
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/suppo...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.


Ken Slovak - [MVP - Outlook] February 5th 09 12:14 AM

Set off VBA macro on email receipt then that macro accesses the email content
 
The code goes in the ThisOutlookSession class. The code is running
in-process with Outlook, so if Outlook is closed the code stops.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
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/suppo...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.




All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com