New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Text Colour change on a Email Macro.

Macros, VBA, Excel Automation, etc.

Text Colour change on a Email Macro.

Postby barrap » Thu Jan 26, 2012 12:19 pm

Hi all,

Great site and ive learnt a lot over the last few weeks. One problem i am having is that i have set up a macro to display an email for sending, however i would like the body of the text to be red, is this possible, the code i have so far which works for the email is:

Sub toemaildisplay()
'

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

strbody = "Dear Colleague" & vbNewLine & vbNewLine & _
"Your GORETEX JACKET:(insert jacket number here) has been condemned, The reason for this is: (insert reason code here)." & vbNewLine & vbNewLine & _
"Order a replacement immediately via CAFM, If you have any difficulties ordering your replacment speak to the Duty Manager. " & vbNewLine & vbNewLine & _
"REASON CODES: 1-Exceeded Wash Limit, 2-Jacket Contaminated, 3-Jacket Damaged, 4-Lost Jacket, 5-Size Has Changed, 6-Other (please specify)." & vbNewLine & vbNewLine & _
"Thankyou, Team Manager"

MsgBox "Click OK and enter name for email"
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "IMPORTANT, PLEASE READ!!"
.Body = strbody
.display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Can i put a code in to change the body text to red? Many thanks in advance for your replies.
  • 0

barrap
Rookie
 
Posts: 2
Joined: Jan 26, 2012
Reputation: 0

Re: Text Colour change on a Email Macro.

Postby Sisyphus » Thu Jan 26, 2012 1:06 pm

Hello barrap,
Strictly speaking - or perhaps not - your question isn't remotely connected with Excel. :D :D
But it is interesting and I found this site for you where, it seemed to me, everything is explained:
http://answers.microsoft.com/en-us/office/forum/office_2003-excel/vba-how-to-change-font-color-etc-in-an-email/67d1201f-806b-e011-8dfc-68b599b31bf5?msgId=e7029559-876b-e011-8dfc-68b599b31bf5


For those who don't want to follow the thread: You have to use HTML to make changes to the font.
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010

Re: Text Colour change on a Email Macro.

Postby barrap » Thu Jan 26, 2012 4:07 pm

Thanks, i appreciate that.
  • 0

barrap
Rookie
 
Posts: 2
Joined: Jan 26, 2012
Reputation: 0


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 130 guests