I want when a specific email is delivered to my inbox to autoforward this email to multiple email addresses with the attachment and body but changing the subject.
Private Sub Application_Startup()
Set objInbox = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
Set objInboxItems = objInbox.Items
End Sub
Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
Dim objMail As Outlook.MailItem
Dim objForward As Outlook.MailItem
If TypeOf Item Is MailItem Then
Set objMail = Item
'If it is a specific new email
If (objMail.SenderEmailAddress = "[email protected]") And _
(objMail.Importance = olImportanceHigh) And _
(objMail.Attachments.Count > 0) Then
Set objForward = objMail.Forward
'Customize the forward subject, body and recipients
With objForward
.Subject = "Custom Subject"
.HTMLBody = "<HTML><BODY>Type body here. </BODY></HTML>" & _
objForward.HTMLBody
.Recipients.Add ("[email protected]")
.Recipients.ResolveAll
.Importance = olImportanceHigh
.Send
End With
End If
End If
End Sub
Sub myAutoFW()
End Sub
I stand on the email in the inbox and run the macro but nothing happened.