troubleshooting Question

Move read messages that came from specified user to a folder

Avatar of Jan Sękara
Jan Sękara asked on
OutlookVisual Basic Classic
4 Comments1 Solution138 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
Edwin Hoffer
Technical Expert
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros