How to get the picture to appear after the textbox using VBA in Excel

I'm trying to send emails to my partners and I'm having trouble figuring out how to get the text (from the text box) to appear after the picture. And when I change the code to do so- the format of the text is lost. here is the code

Sub send_mass_email() Dim i As Integer Dim name, email, body, subject, copy, place, business As String Dim OutApp As Object Dim OutMail As Object

body = ActiveSheet.TextBoxes("TextBox 1").Text

i = 2

Do While Cells(i, 1).Value <> ""
    
    name = Split(Cells(i, 1).Value, " ")(0) 'extract first name
    email = Cells(i, 2).Value
    subject = Cells(i, 3).Value
    copy = Cells(i, 4).Value
    business = Cells(i, 5).Value
    place = Cells(i, 6).Value
    
    
    body = Replace(body, "C1", name)
    body = Replace(body, "C5", business)
    body = Replace(body, "C6", place)

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
         .to = email
         .cc = copy
         .subject = subject
         .body = body
         .HTMLBody = "<img src='https://i.ibb.co/4gVsz56/fastpass.png'> " & _
         .HTMLBody
         .display
         '.Send
         
    End With
    
    body = ActiveSheet.TextBoxes("TextBox 1").Text
        
    
    i = i + 1
Loop

Set OutMail = Nothing
Set OutApp = Nothing

End Sub



Read more here: https://stackoverflow.com/questions/68460670/how-to-get-the-picture-to-appear-after-the-textbox-using-vba-in-excel

Content Attribution

This content was originally published by James Moorhead at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: