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

Using "Rules" to copy incoming email into a folder.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 20th 07, 03:24 PM posted to microsoft.public.outlook.program_vba
Mark - outlook
external usenet poster
 
Posts: 1
Default Using "Rules" to copy incoming email into a folder.

Please advise how I can use "Rules" to copy incoming email into a folder with
the same reference. This would have to recognise a code "EN####" where the
hash is a number.

ie EN1234,
EN1235
En1236 etc

Assume the folders are already created!

  #2  
Old July 20th 07, 05:00 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Using "Rules" to copy incoming email into a folder.

Rules aren't smart enough to do wildcard matching on message contents. You'd
have to write a VBA macro and wire it up so that it fires from other criteria:

How to create a script for the Rules Wizard in Outlook:
http://support.microsoft.com/default...;en-us;q306108

If all of the message data is completely dynamic and a rule can't be created
that satisfies some basic criteria, you'd have to code everything and bypass
rules altogether:

How to create a custom rule in Outlook 2000 by using Visual Basic for
Applications:
http://support.microsoft.com/?kbid=235852


--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Mark - outlook" wrote:

Please advise how I can use "Rules" to copy incoming email into a folder with
the same reference. This would have to recognise a code "EN####" where the
hash is a number.

ie EN1234,
EN1235
En1236 etc

Assume the folders are already created!

  #3  
Old August 4th 07, 02:24 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Using "Rules" to copy incoming email into a folder.

This sounds like a good project for a "run a script" rule action, which uses not an external script but a VBA procedure with a 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
Dim rply as Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
Set rply = msg.Reply
rply.Body = "What you want the reply to say."
rply.To = ; "
rply.Send

Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub

For Outlook VBA basics, see
http://outlookcode.com/article.aspx?id=49

You can use the Instr() and Mid() functions for basic string parsing, if you don't want to dive into regular expressions.

To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm.


--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mark - outlook" wrote in message ...
Please advise how I can use "Rules" to copy incoming email into a folder with
the same reference. This would have to recognise a code "EN####" where the
hash is a number.

ie EN1234,
EN1235
En1236 etc

Assume the folders are already created!

 




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
Some Incoming Email Messages have "clear" text....... Incoming Emails with Clear Color text Outlook Express 6 May 22nd 07 06:52 PM
change incoming email attachment default to "open" vs "save as" conroy Outlook - General Queries 1 December 12th 06 01:58 AM
Assigning "Normal" Importance to incoming email [email protected] Outlook - General Queries 0 May 3rd 06 07:20 PM
Assigning "Normal" Importance to incoming email [email protected] Outlook and VBA 0 May 3rd 06 07:20 PM
Assigning "Normal" Importance to incoming email [email protected] Outlook - General Queries 0 May 3rd 06 07:20 PM


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