Hello
I'm hoping you can help with the following. I have created code to create an Outlook email from excel which works fine. The body of the email pulls it's text from a cell in excel and this generally works fine. The excel cell (B20) has new lines and reads something like this.....
1.Went Shopping
2.Came home
3.Went to sleep
4.Woke up
When I pull it into Outlook it looks like this
1.Went Shopping2.Came home3.Went to sleep4.Woke up
I really need it to look like the original in excel
Is this possible to do in VBA
My existing code is as follows
Sub CREATEEMAIL_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim exptrknumber As String
Dim claimantemail As String
Dim ccemail As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Backgdetail = [B20]
createemail:
On Error Resume Next
With OutMail
.to = ""
.CC = ""
.BCC = ""
.Subject =”Title”
.BodyFormat = olFormatHTML
.htmlbody = "Please see details of Information below "
.htmlbody = .htmlbody & "<br/><br/><b> BACKGROUND </b>"
.htmlbody = .htmlbody & "<br/><br/>" & Backgdetail
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Many Thanks
I'm hoping you can help with the following. I have created code to create an Outlook email from excel which works fine. The body of the email pulls it's text from a cell in excel and this generally works fine. The excel cell (B20) has new lines and reads something like this.....
1.Went Shopping
2.Came home
3.Went to sleep
4.Woke up
When I pull it into Outlook it looks like this
1.Went Shopping2.Came home3.Went to sleep4.Woke up
I really need it to look like the original in excel
Is this possible to do in VBA
My existing code is as follows
Sub CREATEEMAIL_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim exptrknumber As String
Dim claimantemail As String
Dim ccemail As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Backgdetail = [B20]
createemail:
On Error Resume Next
With OutMail
.to = ""
.CC = ""
.BCC = ""
.Subject =”Title”
.BodyFormat = olFormatHTML
.htmlbody = "Please see details of Information below "
.htmlbody = .htmlbody & "<br/><br/><b> BACKGROUND </b>"
.htmlbody = .htmlbody & "<br/><br/>" & Backgdetail
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Many Thanks