We help IT Professionals succeed at work.

Move read messages that came from specified user to a folder

129 Views
Last Modified: 2018-01-17
I want to move messages that came from notify@xyz.com and have [XYZ] in the topic to a specified folder day after they were read.

I have a code that moves... i need conditions.
I'm a noob in outlook macros :/

Please advice.

On Error Resume Next

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolderSrc = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolderDst = objFolderSrc.Folders("@ToFile")

Set colItems = objFolderSrc.Items
Set colfiltereditems = colItems.Restrict("[UnRead] = False")

For intMessage = colfiltereditems.Count To 1 Step -1
    colfiltereditems(intMessage).Move objFolderDst
Next
Comment
Watch Question

Technical Expert
Top Expert 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Edwin,

This is impossible to do with outlook rules.
Edwin HofferTechnical Expert
Top Expert 2014

Commented:
Ok, Let me research on it more then I will help you to get better solutions.....
Edwin HofferTechnical Expert
Top Expert 2014

Commented:
This is the only answer by an expert