troubleshooting Question

Use VBA / macro to modify a rule in Outlook ?

Avatar of Rob Rudloff
Rob RudloffFlag for United States of America asked on
Microsoft OfficeOutlookMicrosoft Development
4 Comments1 Solution2751 ViewsLast Modified:
Hi.  I am a developer, but not familiar with the Outlook 2013 Object Model.
I have a client that has a small task -- In Outlook, he would like to be able to select an email message in his Inbox, and then click a button to append the sender's address to an existing "move to" rule.

He has a "customers.pst" file;  In that PST file, there is a "New Mail" folder.

In Outlook, he already has a rule defined that moves new emails from a list of senders (by email address)  from his default Inbox to the "Customers\New Mail" folder  (when new email is received.)   It takes many steps to manually add a new customer address to that rule.

I assume this would be a simple VBA macro, wherein I would get the "sender" from a selected message, then add it to the existing rule using a call to "Outlook.Rule.Conditions.From.Recipients.Add" or something like that.

I did find this article:  Create a Rule to Move Specific E-mails to a Folder  but have not been successful in modifying the sample code to meet my needs -- I've made a few attempts, but have not been able to point to the proper PST\Folder or successfully modify the "conditions".  

It seems like it would not take much code, so does anyone have any examples?

-- Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
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