Bolding and Highlighting a String (1 Viewer)

DanielR

Registered User.
Local time
Yesterday, 17:34
Joined
Mar 16, 2018
Messages
72
Using VBA in excel I want to place a string in an email:

With newEmail
.Body = "Approval Instruction are as follows:"
End With

I want 'Approval Instruction' to be highlighted and made bold.
How do I do this?
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:34
Joined
Sep 21, 2011
Messages
14,231
Use .HTMLBody and string below?

Code:
"<b>Approval Instructions</b>" & " are as follows:"
 

DanielR

Registered User.
Local time
Yesterday, 17:34
Joined
Mar 16, 2018
Messages
72
This does not work
 

DanielR

Registered User.
Local time
Yesterday, 17:34
Joined
Mar 16, 2018
Messages
72
Sorry, It does work.
How do I specify a line break?
How do I highlight something?
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:34
Joined
Sep 21, 2011
Messages
14,231
Here is something I use in one of my emails.

HTH
Code:
 ' Set up HTML tags
    strPad = "<tr><td>"
    strEndPad = "</td></tr>"
    strPadCol = "</td><td>"
    strBlankLine = "<tr></tr>"


            With objOutlookMsg
                .HTMLBody = .HTMLBody & strPad & str3rdPartyType & strPadCol & str3rdParty & strEndPad
                .HTMLBody = .HTMLBody & strPad & strDatetype & strPadCol & strDate & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Method:" & strPadCol & strMethod & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Reference:" & strPadCol & strRef & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Amount:" & strPadCol & strAmount & strEndPad
                .HTMLBody = .HTMLBody & strPad & "Balance:" & strPadCol & strBalance & strEndPad
                ' Add any notes if they exist
                If Len(strNotes) > 0 Then
                    .HTMLBody = .HTMLBody & strPad & "Notes:" & strPadCol & strNotes & strEndPad
                End If
'                ' Add blank lines for next set
                .HTMLBody = .HTMLBody & strBlankLine & strBlankLine 
            End With
 

isladogs

MVP / VIP
Local time
Today, 01:34
Joined
Jan 14, 2017
Messages
18,209
Also have a look at the attached example which includes highlighting and other HTML tags
 

Attachments

  • RichTextExample.zip
    31 KB · Views: 170

Users who are viewing this thread

Top Bottom