Jena Alissa
Jena Alissa

Reputation: 35

Change font color in html VBA Excel

I can't seem to change the color even with all i tried.

    For Each emailAdress In emailInformation
        Set colLines = emailInformation(emailAdress)
        sBodyInfo = ""
        For Each line In colLines
            sBodyInfo = sBodyInfo & _
                          "Appareil : " & line.appareil & vbCrLf & _
                          "Site : " & line.site & vbCrLf & _

I just want to change "SITE" color in red.

Everytime I try something, it shows the tags appearing in the email like it's a string!

Upvotes: 0

Views: 277

Answers (1)

Guillaume BEDOYA
Guillaume BEDOYA

Reputation: 265

I suppose you are working on creating an email, then you may have a Dim objMail As Outlook.MailItem defined upper in your code. Maybe this is what you are actually trying to do:

 For Each emailAdress In emailInformation
        Set colLines = emailInformation(emailAdress)
        sBodyInfo = ""
        For Each line In colLines
            sBodyInfo = sBodyInfo & _
                          "Appareil : " & line.appareil & vbCrLf & _
                          "<p style=""color:#FF0000"">Site : " & line.site & "</p>"

and then set the .HTMLBody attribute of your objMail object instead of just .Body.

Hope this helps

Upvotes: 1

Related Questions