A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Best way to start a program when specific email received?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 31st 07, 04:01 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Bill
external usenet poster
 
Posts: 4
Default 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.


Ads
  #2  
Old January 31st 07, 04:11 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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
news
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.



  #3  
Old January 31st 07, 04:55 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Bill
external usenet poster
 
Posts: 4
Default 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.
  #4  
Old January 31st 07, 07:40 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Matt Williamson
external usenet poster
 
Posts: 21
Default 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.



  #5  
Old January 31st 07, 10:26 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Bill
external usenet poster
 
Posts: 4
Default 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.
  #6  
Old February 1st 07, 01:06 AM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.


  #7  
Old February 1st 07, 03:44 PM posted to microsoft.public.vb.general.discussion,microsoft.public.outlook.program_vba,comp.lang.basic.visual.misc
Bill
external usenet poster
 
Posts: 4
Default 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.
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sharing specific calendars with specific people. Snyder Outlook - Calandaring 2 October 31st 06 07:03 PM
Enforce Specific Encoding To Messages Arrived From Specific Addres Gil Outlook and VBA 3 April 26th 06 04:00 PM
Moving Specific Inbox Items to a Specific Subfolder (VBA) DevDaniel Outlook and VBA 1 April 11th 06 06:46 AM
Trying to write a program that would collect images received as email attachments Vanessa Lee Outlook and VBA 3 February 20th 06 11:59 PM
How to make Windows/IE default email program profile specific? @Echo Off Outlook Express 2 January 25th 06 07:11 PM


All times are GMT +1. The time now is 03:22 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-2025 Outlook Banter.
The comments are property of their posters.