• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

can i color specific line in email send by excel

MAgicgood

New Member
now i have excel file with vba code that generate email in this generated email there is any way can i change last line color and font style in email body or must to write the code with html
thank you in advance
 

Attachments

  • S.Tawfik - Copy.xlsm
    37 KB · Views: 6
I reviewed your workbook and code. The email macro does create an email but it does not include anything
from the worksheet ????

What line are you seeking to have the edits applied ?

Did you intend to include any data from the worksheet to be included in the email ? If so, where is that code ?
 
I reviewed your workbook and code. The email macro does create an email but it does not include anything
from the worksheet ????

What line are you seeking to have the edits applied ?

Did you intend to include any data from the worksheet to be included in the email ? If so, where is that code ?
No i include Many of cells in my code but i still don't full any cells with data But I include a value in cell under activity and task and value inside cells under note And the name of the receivers with offset and this is a screenshot from output email64694
 
Ok ....

Which line are you speaking of that should be of a different color ? Is it : STANDARDIZATION & COMPLIANCE ?
 
.
Use this :

Code:
With CreateObject("Outlook.Application").CreateItem(0)  '0 will create a new email item
        If Target.Cells.Count > 1 Then Exit Sub
            .To = myToAdd
            .CC = "tamer.elgindy@Test.com"
            .Subject = "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & "assigned to you"
            .HTMLBody = "<HTML><BODY>" & "Dear," & " " & Target & "<br></br><br></br>" & "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & " with note :.." & Target.Offset(0, 1).Value & " " & "in month" & " " & Range("f1").Text & " " & ". assigned to you " & "<br></br>" & "Please follow up till have it Closed or assigned to the responsible ." & "<br></br><br></br><br></br>" & "Keep it up" & "<br></br>" & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>""STANDARDIZATION & COMPLIANCE""</i></font>" & "</HTML></BODY>"
            
            
            .display  'Change this to .Send
            If Err Then
      MsgBox "E-mail was not sent", vbExclamation
    Else
      MsgBox "E-mail successfully sent", vbInformation
    End If
    On Error GoTo 0
End With
 
.
Use this :

Code:
With CreateObject("Outlook.Application").CreateItem(0)  '0 will create a new email item
        If Target.Cells.Count > 1 Then Exit Sub
            .To = myToAdd
            .CC = "tamer.elgindy@Test.com"
            .Subject = "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & "assigned to you"
            .HTMLBody = "<HTML><BODY>" & "Dear," & " " & Target & "<br></br><br></br>" & "You Have a new ( Activities / Tasks / Items )" & " " & Target.Offset(0, -3).Value & " " & " with note :.." & Target.Offset(0, 1).Value & " " & "in month" & " " & Range("f1").Text & " " & ". assigned to you " & "<br></br>" & "Please follow up till have it Closed or assigned to the responsible ." & "<br></br><br></br><br></br>" & "Keep it up" & "<br></br>" & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>""STANDARDIZATION & COMPLIANCE""</i></font>" & "</HTML></BODY>"
           
           
            .display  'Change this to .Send
            If Err Then
      MsgBox "E-mail was not sent", vbExclamation
    Else
      MsgBox "E-mail successfully sent", vbInformation
    End If
    On Error GoTo 0
End With
no words can say how much i appreciate what you did for me this is not thanks this is appreciation thanks :)
 
Back
Top