1

im running Outlook 2016, and i want to Forward specific mails to my gmail. my rule in outlook looks like this:

Apply this rule after the message arrives -> with danlon in the sender's address -> on this computer only -> Run a script

My script is as follows

Sub SendNew(Item As Outlook.MailItem) 
Dim objMsg As MailItem 
Set objMsg = Application.CreateItem(olMailItem) 
objMsg.Body = Item.Body 
objMsg.Subject = "FW: " & Item.Subject 
objMsg.Recipients.Add "my-mail@gmail.com" 

objMsg.Send 
End Sub

Problem is that its making a new template (i guess) instead of forward command, and it is working but it doesnt move the attachments to the template.. and the attachments are the most important.

How do i do this, please keep in mind that i'm not a programmer of any sort.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Possible duplicate of [VBA to forward email with its attachment in Outlook 2010](http://stackoverflow.com/questions/28840066/vba-to-forward-email-with-its-attachment-in-outlook-2010) – niton Feb 24 '16 at 16:45

1 Answers1

0

Try the following.

Option Explicit
Public Sub FW(olItem As Outlook.MailItem)

    With olItem
        .Attachments.Add olItem, olEmbeddeditem
        .Subject = "FW: " & olItem.Subject
        .To = "om3r@.com" ' <- update
        .Send
    End With

    '// Clean up
    Set olItem = Nothing
End Sub
0m3r
  • 12,286
  • 15
  • 35
  • 71