How to Paragraph text within VBA

Mich6661

New Member
Joined
Aug 1, 2013
Messages
19
Hi
I have a vba macro to send out an email and attached file. when sent, the verbage is just 1 long line of text.

Sub Mail_Workbooks()
Dim OutApp As Object, OutMail As Object, WS As Worksheet, r As Long


Set OutApp = CreateObject("Outlook.Application")

Set WS = Sheets("Sheet1")
On Error Resume Next


For r = 2 To WS.Cells(Rows.Count, "A").End(xlUp).Row

With OutApp.CreateItem(0)
.To = WS.Cells(r, 1).Value
.CC =
.BCC = ""
.Subject = "Order Book Review Wk51"
.Body = "Pls find attached the latest order book detailing past due orders, orders due within the next 14days and any orders that we have not yet received delivery confirmation for. This report will be issued weekly and it is your responsibility to respond with the worksheet fully completed within 48hours of receipt. You should only respond to the SCO Purchasing email address on copy. Do not send back to myself. If there is no attachment, that means you have no open obligations for this week. Any issues, pls do not hesitate to advise by return. ***PLEASE NOTE - OUR LAST RECEIVING DATE FOR 2019 IS 20 DEC 2019***"
.Attachments.Add WS.Cells(r, 2).Value
.Send
End With
DoEvents
Next r

On Error GoTo 0
Set OutApp = Nothing
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Please use code tags to insert code in your post.

Emails frequently one line of text and the email client displays it with word wrap. I'm not clear on why this is a problem in this case, however, to insert line breaks you can use the constant vbCrLf. For example:

Rich (BB code):
.Body = "Any issues, pls do not hesitate to advise by return." & vbCrLf & vbCrLf _
" ***PLEASE NOTE - OUR LAST RECEIVING DATE FOR 2019 IS 20 DEC 2019***"

Another option is to use HTML instead of plain text
VBA Code:
.HTMLBody = "First paragraph<p>Another paragraph"
 
Upvote 0

Forum statistics

Threads
1,226,224
Messages
6,189,728
Members
453,566
Latest member
ariestattle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top