Log in

View Full Version : Auto Forward Based on Subject



dmcgettigan
11-05-2015, 06:37 AM
Good morning,

Before anyone says, "Use the rules in Outlook", I am on exchange server and my orginization will not allow auto forwarding outside of our network.:)

I have 2 emails that I receive everyday that I need to auto forward to 5 email addresses. They have the following subjects,"DM RUGES FBO REPORT.csv attached" and "DM RUGES OPEN ORDERS.csv attached".

I have very little experience with Outlook VBA, but based on some reading here, I think it can be done.

Thank for the help!

Darren

skatonni
11-09-2015, 01:45 PM
Try a rule with a Run a Script option. I do not uses Run A script myself but it is the easiest method to describe. If the rule breaks change to ItemAdd. http://www.outlookcode.com/article.aspx?id=62


Sub AutoForwardByRunAScript(itm As mailItem)

Dim myItem As mailItem
Dim myRecipients As Recipients
Dim myRecipient As recipient

Set myItem = itm.Forward
Set myRecipients = myItem.Recipients

With myRecipients

.Add "jack"
.Add "jill"

.ResolveAll

End With

For Each myRecipient In myRecipients
If Not myRecipient.resolved Then
myItem.Display
GoTo ExitRoutine
End If
Next

myItem.send

ExitRoutine:
Set myItem = Nothing
Set myRecipients = Nothing

End Sub