0

I have a macro-code that attaches a picture in the e-mail body from the excel Activesheet. My problems are:

  1. Is there a possibility to place the image above "Thank you" line ?
  2. If I want to insert a second picture how can I modify the code so that the Picture2 will be placed bellow Picture1 (currently it's placing in the right of Picture1)

Any ideas ?

         Sub create_email_2()
         Dim oApp As Outlook.Application
         Dim email As Outlook.MailItem

         Dim inspect As Outlook.Inspector
         Dim content As Object

         Set oApp = New Outlook.Application
         Set email = oApp.CreateItem(olMailItem)
         With email
         .To = "magic@gmail.com"
         .Subject = "E-mail2"
         .htmbody = "Hello" & "</p>" _
         & "Please see bellow current status" & "</p>" _
         & "Thank you" & "</body></html>"

         .Display
         Set inspect = email.GetInspector
         Set content = inspect.WordEditor

         ActiveSheet.Pictures(1).Copy
         content.Application.Selection.Start = Len(.Body)
         content.Application.Selection.Paste

         'ActiveSheet.Pictures(2).Copy
         'content.Application.Selection.Start = Len(.Body)
         'content.Application.Selection.Paste
          .Save
         '.Send
         End With

         End Sub
Dolly
  • 3
  • 4
  • Where are you running the code from, Excel or Outlook? – 0m3r Sep 03 '20 at 21:27
  • See https://stackoverflow.com/questions/44693988/paste-clipboard-in-outlook-email-in-normal-order. Create an answer post if you figure it out. Tag the question with ms-word if you need more. – niton Sep 04 '20 at 01:22
  • @0m3r, the code is runned from excel and the picture is also in the excel file, niton I will add the ms-word – Dolly Sep 08 '20 at 12:58
  • `.HTMLBody = "Hello" & "" & "Please see bellow current status" & ""` then `.Paste` then `.HTMLBody = .HTMLBody & "" & "Thank you" & " – niton Oct 10 '20 at 13:59

0 Answers0