Thread: E-mail macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default E-mail macro

Hi

Dim strbody As String
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

Or try this if you want to use cell values

Dim cell As Range
Dim strbody As String
For Each cell In ThisWorkbook.Sheets("Sheet1").Range("C1:C60")
strbody = strbody & cell.Value & vbNewLine
Next


Dim strbody As String
With ThisWorkbook.Sheets("Sheet1")
strbody = "Hi there" & vbNewLine & vbNewLine & _
.Range("A1") & vbNewLine & _
.Range("A2") & vbNewLine & _
.Range("A3") & vbNewLine & _
.Range("A4")
End With


Change the Body line to .Body = strbody to use the string.


See also
http://www.rondebruin.nl/sendmail.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"G and (ajk)" wrote in message ...
Hi,

When using the visual basic macro to send e-mails via outlook, how can I
insert line breaks into the text of the e-mail message so that they appear
when the e-mail is sent?

When I try and do it by pressing return in the macro, that part of it turns
red and does not send.

Can you help please?

Thanks!