Outlook 365 - Create link in email body to attached file RRS feed

  • Question

  • Hello,

    I have a piece of code which I have been using to create links in the email body.

    The code below is just an example but has been working fine until I've moved to Office 365. Now, it does not work anymore.

    The link created in the email body does not tie up with the attachment. 

    Private Sub attachementTool()
       Dim msg
       Dim attach
       Set msg = Application.CreateItem(0)
       msg.To = "me@gmail.com"
       msg.Subject = "test link"
       msg.HTMLBody = "<html><body>click <a       href=""cid:attachCid1"">here</a> to open attachment <br />" & _
                    "click <a href=""cid:attachCid2"">here</a> to open attachment</body></html>"
       Set attach =    msg.Attachments.Add("C:\Users\Me\Desktop\attach1.pdf")
       attach.PropertyAccessor.SetProperty    "http://schemas.microsoft.com/mapi/proptag/0x3712001F", "attachCid1"
       Set attach =       msg.Attachments.Add("C:\Users\Me\Desktop\attach2.pdf")
       attach.PropertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x3712001F", "attachCid2"
    End Sub

    Can anyone confirm why this no longer works with 365?

    Please help.

    Thanks in advance.

    Friday, November 9, 2018 4:30 PM