PDA

View Full Version : Font red and Bold specific dates returned on email sent.



wilg
04-02-2011, 08:45 AM
Hi, have the below code which is part of a macro to email dates of instances of "PP", "PU" etc. it also emails the dates of these instances. I would like the instances of any Saturdat or Sunday to font red and bold. Any suggestions?



Dim Email_Subject, Email_Send_From, Email_Send_To, _
Email_Cc, Email_Bcc, Email_Body As String
Dim Mail_Object, Mail_Single As Variant
Email_Subject = "email " & ActiveSheet.Range("a5").Text
mail_Send_From = ""
Email_Send_To = ""
Email_Cc = ""
Email_Bcc = ""
Email_Body = vbNewLine & "email" & ActiveSheet.Range("a5").TextOn Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
Email_Body = Email_Body & vbNewLine & vbNewLine & "Dear "
.Body = Email_Body
For i = 2 To 32

'january
If Cells(10, i).Value = "PU" Or Cells(10, i).Value = "PP" Or Cells(10, i).Value = "F" Then

Email_Body = Email_Body & vbNewLine & Format(Cells(8, i).Value, "dddd mmmm d, yyyy = ") & Cells(10, i).Value ' want to highlight bold if the dddd is "SA"(Saturday) or "SU"(sunday)
End If

Next i

.Body = Email_Body

wilg
04-02-2011, 03:37 PM
I'm researching further info and getting info to use HTML formatting, but can't seem to figure this one out to apply it to the dates if the dates return back saturday or sunday.