0
votes

Here is the scenario: My Outlook Inbox has a sub-folder called Notice. Every day, I will check and forward notices to my colleague if there is any automated notice in this folder. I would like to run a vba so that it will go into this folder, check inside, and if there is an email then forward, otherwise stop.

I would seek for your assistance on this scenario as I'm quite new to visual basic on outlook. Thank you very much.

Tony

1

1 Answers

0
votes

You could create a macro rule when the folder received an email then forward this email.

Please refer to the below code:

Sub ForwardEmail(Item As Outlook.MailItem)
// Determine if it’s an email
If TypeName(Item) = "MailItem" Then
    With Item.Forward
        .Subject = ("ITS - ") & Item.Subject
        .Recipients.Add "[email protected]"
        ' You need to overwrite the Body or HTMLBody to get rid of the auto signature
        .HTMLBody = Item.HTMLBody ' <-- Or use .Body for Plain Text
        '.Display ' <-- For Debug
        .Send ' <-- Put break here to Debug
End With
End If
End Sub

For more information, please refer to these links:

Otlook vba and rule to forward email message and change subject

VBA Copy sent mail to folder based on key words in subject