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

Automatic action upon reception of a message



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 26th 07, 09:43 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 3
Default Automatic action upon reception of a message

Hi

I need to execute a script when a message is received by a specific
sender and/or a specific subject and/or it contains some string in the
message text

Can I do that with vba?

Otherwise (even better) can I automatically create a txt
subject_sender.txt in a specific directory with the content of the e-
mail ?

thanks and regards

Nicola Attico

Ads
  #2  
Old May 8th 07, 04:27 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Automatic action upon reception of a message

Consider writing a VBA procedure for use with a "run a script" rule action. Such a procedure has the incoming MailItem or MeetingItem as its parameter. That item is processed by the code:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

To create a message using external file content, see http://www.slipstick.com/mail1/html.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message ps.com...
Hi

I need to execute a script when a message is received by a specific
sender and/or a specific subject and/or it contains some string in the
message text

Can I do that with vba?

Otherwise (even better) can I automatically create a txt
subject_sender.txt in a specific directory with the content of the e-
mail ?

thanks and regards

Nicola Attico

 




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
Reception des message dans supprimer ?? FRANVOY Outlook Express 1 February 16th 07 04:11 PM
non reception de messages marie-france latty Outlook Express 1 October 16th 06 09:09 AM
"Action canceled" message when clicking on a link in HTML email [email protected] Outlook - General Queries 0 August 9th 06 07:27 PM
new account = no reception maples Outlook Express 2 March 3rd 06 01:31 AM
server-requested client action message MCSA-M Outlook - General Queries 7 January 18th 06 08:24 PM


All times are GMT +1. The time now is 03:03 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.