.HTMLBody

G

Greg H.

Im having problems with the code below displaying the text on one line. E4
is reference to a date i select in the worksheet.

.htmlBody = Format(Range("E4") - 2, "mm/dd") & " ECCR (Daily, MTD)"
& _
Format(Range("E4") - 1, "mm/dd") & " ECCR (Daily, MTD)" & _
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD)"

The result should look like this:

08/24 ECCR (Daily, MTD)

08/25 ECCR (Daily, MTD)

08/26 ECCR (Daily, MTD)

Any Ideas?
 
T

Tom Ogilvy

.htmlBody = Format(Range("E4") - 2, "mm/dd") & _
" ECCR (Daily, MTD)" & vbCrLf & _
Format(Range("E4") - 1, "mm/dd") & _
" ECCR (Daily, MTD)" & vbCrLf & _
Format(Range("E4"), "mm/dd") & _
" ECCR (Daily, MTD)"
 
G

Greg H.

Unfortunately this does not work. And when i try what Ron sugested, using
<br> i do this:

.htmlBody = Format(Range("E4") - 2, "mm/dd") & " ECCR (Daily, MTD)"
<br> & _
Format(Range("E4") - 1, "mm/dd") & " ECCR (Daily, MTD)"
<br> & _
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD)"

And i get this error: "Compile error: Syntax error" and it highlights the &
after the <br>. Any ideas?
 
R

Ron de Bruin

See this example

<br> is between the " "

strbody = "<H3><B>Dear Customer</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""http://www.rondebruin.nl/"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
 
G

Greg H.

When i apply the "" i receve the error of : "Compile Error: Syntax Error" and
it highlights E4 in "Format(Range("E4") - 2, "mm/dd") & " ECCR (Daily, MTD)"
<br>" & _
 
R

Ron de Bruin

Use it like this

strbody = "<H3><B>Dear Customer</B></H3>" & _
Format(Range("E4") - 2, "mm/dd") & " ECCR (Daily, MTD)<br>" & _
Format(Range("E4") - 1, "mm/dd") & " ECCR (Daily, MTD)<br>" & _
Format(Range("E4"), "mm/dd") & " ECCR (Daily, MTD)<br>" & _
"<br><br><B>Thank you</B>"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top