How to add blank row to body of Outlook email in VBA

jakeman

Active Member
Joined
Apr 29, 2008
Messages
325
Office Version
  1. 365
Platform
  1. Windows
I am trying to write some VBA code that will create an Outlook email for me with a generic message in the body. I don't know how to create blank rows in the body so that I can include a closing.

The code I have so far looks like this:

Code:
Sub Adherence_email_MHA()

Dim myOutlook As Object
Dim myMailItem As Object

Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)

With otlNewMail
.To = "_MHAManagement"
.Subject = "Adherence updated"
.body = "sentence 1"  ****here I'd like to put a blank line after this sentence
.body = "sentence 2"  **** this would be the closing

'.Attachments.Add
.Display

End With


Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing


End Sub
Thanks.

Jake
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
You can utlitlze the newline constant as follows. Note: You should lose the second .body declaration.

Incidentally, the link below is a great source for Example Code for sending mail from Excel

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


With otlNewMail
.To = "_MHAManagement"
.Subject = "Adherence updated"
.body = "sentence 1" & vbNewLine & vbNewLine & _
"sentence 2"
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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