![]() |
Best way to start a program when specific email received?
I have posted this to both the outlook and vb groups because I am not
sure of the best way to approach this. I have written a VB program that processes an email based on the customer it is received from, the type of order, etc. I would like the program to start up whenever an email is received by the address I have Outlook set to. Am I better off to wake up my program periodically and check for the emails? Or is there a way to just have Outlook call my program when an email is received? I know how to save the email to a file or database when it is received but I am not aware of how to kick off a program from Outlook when an email is received. I would appreciate all thoughts and pointers to articles or discussions. This seems to fall in between the two programs as I am looking for the best practice. Thank you in advance for your help. |
Best way to start a program when specific email received?
The best and most robust way is to use an Outlook COM addin, which can
handle the ItemAdd event in the Items collection of the Inbox. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Bill" wrote in message ... I have posted this to both the outlook and vb groups because I am not sure of the best way to approach this. I have written a VB program that processes an email based on the customer it is received from, the type of order, etc. I would like the program to start up whenever an email is received by the address I have Outlook set to. Am I better off to wake up my program periodically and check for the emails? Or is there a way to just have Outlook call my program when an email is received? I know how to save the email to a file or database when it is received but I am not aware of how to kick off a program from Outlook when an email is received. I would appreciate all thoughts and pointers to articles or discussions. This seems to fall in between the two programs as I am looking for the best practice. Thank you in advance for your help. |
Best way to start a program when specific email received?
On Wed, 31 Jan 2007 10:11:08 -0500, "Ken Slovak - [MVP - Outlook]"
wrote: The best and most robust way is to use an Outlook COM addin, which can handle the ItemAdd event in the Items collection of the Inbox. Thank you. I've done quite a bit of programming, but never used COM. I will look into that. Do you have a suggestion I might be able to use more quickly? Thanks. |
Best way to start a program when specific email received?
Do you have a suggestion I might be able to use more quickly?
Depending on which version of Outlook you have, you can setup a mail rule to run your program on an incomming email to a specified address. |
Best way to start a program when specific email received?
On Wed, 31 Jan 2007 13:40:56 -0500, "Matt Williamson"
wrote: Do you have a suggestion I might be able to use more quickly? Depending on which version of Outlook you have, you can setup a mail rule to run your program on an incomming email to a specified address. Outlook 2000, Service Pack 3. I will take a look at that. Thanks. |
Best way to start a program when specific email received?
You can prototype your code as a macro that runs automatically in the
Outlook VBA. It would be put in the ThisOutlookSession class. Dim WithEvents colItems As Outlook Items Private Sub Application_Startup() Dim oNS As Outlook.NameSpace Set oNS = Application.GetNameSpace("MAPI") Set colItems = oNS.GetDefaultFolder(olFolderInbox) End Sub Then just select colItems in the left drop-down, ItemAdd in the right drop-down and the prototype of the event handler will be added to the class. The next time you start Outlook it will run for every new item (for 15 or fewer items at a time). Make sure your macro security is set to allow the macro to run. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Bill" wrote in message ... On Wed, 31 Jan 2007 10:11:08 -0500, "Ken Slovak - [MVP - Outlook]" wrote: The best and most robust way is to use an Outlook COM addin, which can handle the ItemAdd event in the Items collection of the Inbox. Thank you. I've done quite a bit of programming, but never used COM. I will look into that. Do you have a suggestion I might be able to use more quickly? Thanks. |
Best way to start a program when specific email received?
On Wed, 31 Jan 2007 19:06:08 -0500, "Ken Slovak - [MVP - Outlook]"
wrote: You can prototype your code as a macro that runs automatically in the Outlook VBA. It would be put in the ThisOutlookSession class. Dim WithEvents colItems As Outlook Items Private Sub Application_Startup() Dim oNS As Outlook.NameSpace Set oNS = Application.GetNameSpace("MAPI") Set colItems = oNS.GetDefaultFolder(olFolderInbox) End Sub Then just select colItems in the left drop-down, ItemAdd in the right drop-down and the prototype of the event handler will be added to the class. The next time you start Outlook it will run for every new item (for 15 or fewer items at a time). Make sure your macro security is set to allow the macro to run. Thank you. |
All times are GMT +1. The time now is 12:43 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