Y
Y
Yura Khlyan2015-03-25 15:27:25
HTML
Yura Khlyan, 2015-03-25 15:27:25

The text of the letter in HTML (VBA) format does not display pictures correctly. What to do?

Good time of the day.
I have an email macro where the text of the email is entered as HTML text. I need two pictures above the text, one on the left and one on the right. There is HTML code, and which works normally in a notepad (displays everything as it should). But when the same code (slightly prepared for VBA) generates the text of the Outlook message, then the pictures are one next to the other, and not on opposite sides.
I will be very grateful for your help.
Here is the macro part:

With OutMail
.SentOnBehalfOfName = Range("F2")
.To = cell.Value 
.Subject = Range("B2").Value
 
.HTMLBody = "<img src='http://www.portmone.com.ua/v2/kredobank/i/logo.gif' style='position: relative; top: 50px; float:left'>" & _
"<img src='http://s7.hostingkartinok.com/uploads/images/2015/03/f7d69e22f111c246af8a2c035a813355.png' style='position: relative; left:-50px; float:right'> " & _
"<div style='font-family: calibri; font-size: 14; color: #205aa0' >" & _
"Много текста________________________________________________________________________________________________________________________________________" & _
"</div>"

PS, Sorry for my bad Russian.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Merk, 2015-03-25
@MAGistr_MTM

Letters are very fond of falling apart and being displayed in different mail services and programs in different ways. In your case, I recommend using the table:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
  </head>
  <style>
    * {
      padding: 0px;
      margin: 0px;
      font-size: 12px;
    }
    table {
      border-collapse: separate;
    }
  </style>
  <body style="width: 100%;">
    <table id="wrap" cellspacing="0" cellpadding="0" border="0" style="border-collapse: separate; width: 100%;">
      <tr>
        <td>
          <img src="http://www.portmone.com.ua/v2/kredobank/i/logo.gif">
        </td>
        <td>
          Много текста________________________________________________________________________________________________________________________________________
        </td>
        <td>
          <img src='http://s7.hostingkartinok.com/uploads/images/2015/03/f7d69e22f111c246af8a2c035a813355.png'>
        </td>
      </tr>
    </table>
  </body>
</html>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question