Consulting

Results 1 to 2 of 2

Thread: Auto Forward Based on Subject

  1. #1

    Auto Forward Based on Subject

    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

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    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
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •