-
Automatically Run code when new message received
I would like to configure something in Outlook so that every time a new message arrives in a certain folder it runs a script. I have a program to parse the subject of an e-mail but it has to do this manually. Is there anyway to automate this process so that once the e-mail comes in it will run my code. Another possible but less desired solution would be to have Outlook on a timer to run my code every so often.
-
Set up the rules wizard to run your code on incoming emails. You can use the following example code:
[VBA]Sub CustomMailMessageRule(Item As Outlook.MailItem)
MsgBox "Mail message arrived: " & Item.Subject
End Sub[/VBA]
Call your custom function from within the procedure that is run by the rule.
-
In the Outlook rules I do not see a message to check if a new message is in a folder, it will check for everything. Is there anyway to make it focus on a specific folder because this thing will be running constantly otherwise.
-
You may want to adapt this code instead:
http://www.vbaexpress.com/forum/showthread.php?t=35910
You would call your custom function from the Items_ItemAdd Event.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules