Consulting

Results 1 to 2 of 2

Thread: Font red and Bold specific dates returned on email sent.

  1. #1
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location

    Font red and Bold specific dates returned on email sent.

    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?



    [VBA]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[/VBA]

  2. #2
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •