I am using a function to send emails using HTML.
We are using .HTMLBody for the command for the email body.
Here is the code we use:
.HTMLBody = "<font color=""""red"""">" & Temp_Body & "</font>" & vbNewLine & vbNewLine & RangetoHTML(rng) & Thank_You
We have the following issue:
1.We use Temp_Body for geeting a string from a range from the Excel spreadsheet.
It seems that temp_body has the formatting correctly for what is in the range however once used in the .HTMLBody it loses its formatting for line breaks between sentences.
It puts all the sentences in the same line.
Is there any way to work around this?
2.We would like the Temp_Body to be formatted in the red color.
We are using = "<font color=""""red"""">" which was advised by Daffodil11
here is the link to the thread we got advice for
http://www.excelforum.com/showthread...84#post4075984
However his idea seems not to work any other ideas?
Thank you for your help.
Here is the sub code in full.
Sub Mail_Sheet_Outlook_Body()
'This is the macro that send active sheet as body
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Don't forget to copy the function RangetoHTML in the module.
'Working in Excel 2000-2013
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim I As Integer
Dim temp_sku As String
Dim Temp_Attachment As String
Dim Temp_Body As String
Dim Thnak_You As String
Thank_You = "Thank You"
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set rng = Nothing
Set rng = ActiveSheet.UsedRange
'You can also use a sheet name
'Set rng = Sheets("YourSheet").UsedRange
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "e@gmail.com"
.CC = ""
.BCC = ""
.Subject = "test1"
lr = ActiveSheet.Range("A" & Rows.Count).End(xlUp).row
'.HTMLBody = Temp_Body & vbNewLine & vbNewLine & RangetoHTML(rng) & Thank_You
.HTMLBody = "<font color=""""red"""">" & Temp_Body & "</font>" & vbNewLine & vbNewLine & RangetoHTML(rng) & Thank_You
Attachments.Add (Temp_Attachment)
Next I
.Send 'or use .Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Bookmarks