The below code (I pulled from several sources) now works in that when I receive an email with specific words in the subject line it triggers a script that runs the below. >
There is no need to use the Explorer object in the code:
Sub ForwardEmail(item As Outlook.MailItem)
Dim oMail As MailItem
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
oMail.Recipients.Add "email address here"
oMail.Save
oMail.Send
End If
Release:
Set oMail = Nothing
Set oExplorer = Nothing
End Sub
You may find the Getting Started with VBA in Outlook 2010 article helpful.