Image placement in an e-mail via VBA

  • MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question


    mrexcel.com/board/threads/imag…n-e-mail-via-vba.1145132/


    Hello everyone,

    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 ?

  • Let's I have changed the way I have structured the e-mail content and before adding the snip I added some extra lines that insert a range from Activesheet.


    Code
    1. Range("J5:U9").Copy
    2. contentR.Application.Selection.Start = Len(.Body)
    3. contentR.Application.Selection.Paste



    Problem is that for some e-mails I get error 1004 - Copy method of picture class failed highlighting the copy codeline and if I click debug and press F5 the macro resumes from where it broke - with job complete. For a few e-mails is ok to press debug and F5 but for more than 100 is not funny.

    I have tried with an On error resume next but for the e-mails where the error would occur I get them incomplete (no range and no image inserted).


    Any ideea on how to bypass it ?

  • Post by nikkireed ().

    This post was deleted by royUK: Spam ().