Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Outlook Customized Rules

Posted on 2014-02-22
3
Medium Priority
?
226 Views
Last Modified: 2014-02-23
I have a series of outlook rules in Outlook 2013 that funnel emails to appropriate folders upon receipt.

I manage a number of small projects (15-20) at a time and each one is active for 1 to 2 months.

I create a folder for each project with a 5 digit job number in the folder name.

Each email has the 5 digit job number in the subject.

Right now I create a new rule for each project which is a bit takes more effort than I would like to manage.

I would like to create a "generic" rule that searches the email for a job number that matches one of the folders and if a match is found moves a copy to that folder.

Alternately, I keep a running job list in a spreadsheet that has the job# and description (which matches the folder name) and if possible, the rule could search through the spreadsheet, find the job# in one column and find the folder name in the next column and then move the email to the right folder.

I'm not asking for the full code - some pointers on how to get started would be appreciated.

Thanks
0
Comment
Question by:rogerdjr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
regmigrant earned 2000 total points
ID: 39879936
you can create a rule that applies to all message and instead of the default action you can run a vba script. EE has an article by BlueDevilFan introducing that:

http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_420-Extending-Outlook-Rules-via-Scripting.html

Here's some snippets that might help - from http://www.outlookcode.com/ which is a great resource for starting Outlook VBA (as I am)


'You can manipulate the sub folders using something like this:-
' this process recursively loops through sub folders, to compare names to subjects for example

Sub ProcessFolder(StartFolder As Outlook.MAPIFolder)
    Dim objFolder As Outlook.MAPIFolder
    Dim objItem as Object
    On Error Resume Next
     
    ' do something specific with this folder
    Debug.Print StartFolder.FolderPath, StartFolder.Items.Count
    Debug.Print
         
    ' process all the subfolders of this folder
    For Each objFolder In StartFolder.Folders
        Call ProcessFolder(objFolder)
    Next
     
    ' process all the items in this folder
    For Each objItem In StartFolder.Items
        Call ProcessItem(objItem)
    Next
     
    Set objFolder = Nothing
End Sub

' and this creates a sub folder based on a subject line and moves the item
Sub Process_One_MailAndAddFolder()

' ***
' *** Creates a destination folder for single selected mail item
' *** The folder name is based on the subject of the email
' ***

Dim OutlApp As Object
Dim OutlNs As Object
Dim OutlInBoxFolder As Object
Dim OutlItem As Object
Dim strMailheader As String

Set OutlApp = Outlook.Application
Set OutlNs = OutlApp.GetNamespace("MAPI")

' Replace Clients. Add as many .Folders("...") to the end as necessary
Set OutlInBoxFolder = OutlNs.GetDefaultFolder(olFolderInbox).Folders("Clients")

' Select an item, do not open
Set OutlItem = OutlApp.ActiveExplorer.Selection.Item(1)

strMailheader = "Quote - " & OutlItem.Subject

If ActiveExplorer.CurrentFolder = strMailheader Then
    MsgBox "You have selected an item with a name used on a previously created destination folder."
    GoTo exitRoutine
End If

On Error Resume Next
OutlInBoxFolder.Folders.Add strMailheader
If Err = 440 Then
    MsgBox "A folder named " & vbCr & vbCr & strMailheader & vbCr & vbCr & "already exists." & _
        vbCr & vbCr & "Currently selected mail has not been moved."
    GoTo exitRoutine
End If
On Error GoTo 0

OutlItem.Move OutlInBoxFolder.Folders(strMailheader)

Set ActiveExplorer.CurrentFolder = OutlInBoxFolder.Folders(strMailheader)
OutlInBoxFolder.Folders(strMailheader).items(1).Display

exitRoutine:

Set OutlItem = Nothing
Set OutlInBoxFolder = Nothing
Set OutlNs = Nothing
Set OutlApp = Nothing

End Sub 

Open in new window

0
 

Author Comment

by:rogerdjr
ID: 39880728
thanks for a great start - I'll update as I make progress
0
 

Author Closing Comment

by:rogerdjr
ID: 39880730
Thanks for a great start - I'll keep you posted as I make progress
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question