Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I ran across a post on Super User that addressed a question about Outlook email forwarding. One user provided a script to utilize.

Sub AutoForwardAllSentItems(Item As Outlook.MailItem)
Dim strMsg As String
Dim myFwd As Outlook.MailItem

Set myFwd = Item.Forward

myFwd.Recipients.Add "email@email.com"
myFwd.Send
Set myFwd = Nothing 
End Sub

This worked good for me, but how would it work if I want to just automatically forward email in a specific folder only? The folder already has email auto directed to it upon receipt. Any ideas?

share|improve this question
    
@DaveM Check the formatting next time, please. –  slhck Feb 16 '12 at 18:31
add comment

1 Answer

Assuming that you are redirecting the email into the folder using a rule, you could run this script in the same rule, so it would only apply in the same conditions.

Otherwise the macro can be altered to look for unread messages in the current folder and forward them. You'd then just manually run the macro (give it a shortcut to make it easy) periodically whilst in that folder and it'll do the forwards for you.

Sub ForwardUnreadInFolder()
  Dim CurItem As Outlook.MailItem
  Dim myFwd As Outlook.MailItem
  Dim strMsg As String

  Set CurFolder = Application.ActiveExplorer.CurrentFolder
  Set AllItems = CurFolder.Items
  NumItems = CurFolder.Items.Count

  For i = 1 To NumItems

    DoEvents

    Set CurItem = AllItems.Item(i)

    If (CurItem.UnRead) Then

        Set myFwd = CurItem.Forward
        myFwd.Recipients.Add "email@example.com"
        myFwd.Send
        Set myFwd = Nothing

    End If

  Next

   MsgBox "Done"
End Sub
share|improve this answer
1  
Thanks. Yes I first tried the copying to another folder but realized the separate rule for the script forwarded all msgs first. . then copied. SO i did change the rule to move a copy of emails to a folder and had the rule run the script after that . . but it continued to auto forward every email before moving any to the folder. All emails in the new folder show as unread and NOT forwarded. Was hoping this could be automated without having to manually run macros or other, since if I am not at the computer nothing can get forwarded. Thank you for the reply. –  Ian Feb 16 '12 at 21:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.