0

I'm working on a script to auto forward mail with custom message and attachment from original mail.

Code is running but one of the attachments is the original message like this:
Example

How do I remove it?

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

    With olItem
        .Attachments.Add olItem, olEmbeddeditem
        .Subject = "" & olItem.Subject
        .Body = "Hello there."
        .To = "someone@somewhere.com" ' <- update
        .Send
    End With

    '// Clean up
    Set olItem = Nothing
End Sub
Community
  • 1
  • 1
  • 1
    Possible duplicate of [Forward Email with its attachment in Outlook 2010](https://stackoverflow.com/questions/28840066/forward-email-with-its-attachment-in-outlook-2010) – niton Jul 19 '17 at 11:16

1 Answers1

1

You are better off just using the .Forward method to create a forwarded version of the original email, as this automatically retains any attachments.

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

    Dim olForward as Outlook.MailItem
    Set olForward = olItem.Forward

    With olForward
        .Subject = "" & olItem.Subject
        .Body = "Hello there."
        .To = "someone@somewhere.com" ' <- update
        .Send
    End With

    '// Clean up
    Set olItem = Nothing
    Set olForward = Nothing
End Sub
finjo
  • 366
  • 4
  • 19