I take code from different sources and put them together.
I want to manually categorize emails, manually select the ones I want to send, then automatically forward the selected emails to the appropriate party based on the category.
I've been using two sources to try to make this work:
Forward Email with its attachment in Outlook 2010
Here is what I put together. When I run it, nothing happens:
Sub ForwardMSREmail()
Dim oExplorer As Outlook.Explorer
Dim oMail As MailItem
Set oExplorer = Application.ActiveExplorer
On Error GoTo Release
If item.Class = olMail Then
Set oMail = item.Forward
oMail.Subject = oMail.Subject
oMail.HTMLBody = "Have a nice day." & vbCrLf & oMail.HTMLBody
Dim objMail As Outlook.MailItem
If InStr(objMail.Categories, "Joshua") > 0 Then
oMail.Recipients.Add "email address"
oMail.Save
oMail.Send
End If
End If
Release:
Set oMail = Nothing
Set oExplorer = Nothing
End Sub