PDA

View Full Version : help with a forwarding email macro



beans
07-23-2013, 05:34 AM
wondering if anbody can help, i am using the below macro to forward emails and it works fine but would like if it could have a sent from email address added and keep the original message from the email in the subject line. then once it has sent to flag it as complete and move it to another folder ie: archive. i am only new at VBA and have tried some things but nothing is working for me.Sub ForwardEmail() Dim oExplorer As Outlook.Explorer Dim oMail As MailItem Set oExplorer = Application.ActiveExplorer On Error GoTo Release If oExplorer.Selection.Item(1).Class = olMail Then Set oMail = oExplorer.Selection.Item(1).forward oMail.Subject = Subject oMail.HTMLBody = "test" & oMail.HTMLBody oMail.Recipients.Add "xxxx@xxxx.com" oMail.Recipients.Item(1).Resolve If oMail.Recipients.Item(1).Resolved Then oExplorer.Selection.Item(1).UnRead = False oMail.Display ' oMail.Send Else MsgBox "Could not resolve " & oMail.Recipients.Item(1).Address End If Else MsgBox ("Not a mail item") End IfRelease: Set oMail = Nothing Set oExplorer = NothingEnd Sub