Avatar of Jan Sękara
Jan Sękara
 asked on

Move read messages that came from specified user to a folder

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
OutlookVisual Basic Classic

Avatar of undefined
Last Comment
Edwin Hoffer

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Edwin Hoffer

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jan Sękara

Edwin,

This is impossible to do with outlook rules.
Edwin Hoffer

Ok, Let me research on it more then I will help you to get better solutions.....
Edwin Hoffer

This is the only answer by an expert
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes