how to add <b> to text

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
Office Version
  1. 2010
Platform
  1. Windows
Hi please can you help me, I have the cold below where I want the "comments" to be in bold, how do I do this please? I have tried the <B> in front of the comments but this didn't work.

Code:
"Comments: " & Me.TextBox9.Value & Chr(10) & _
 
Last edited by a moderator:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
How/where are you displaying the text?
 
Upvote 0
Hi this is the whole code below, it is in the aEmail.body section , and the comments bit I need in bold if you can help please?

Code:
Private Sub CommandButton4_Click()
    If NotesBox.Value = "" Then
        MsgBox "Please enter 'Comments'"
        Exit Sub
    Else

    End If
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
        aEmail.Body = "Hi There," & Chr(10) & vbCrLf & _
                      "Appt Number: " & Me.TextBox5.Value & Chr(10) & _
                      "MPAN / MPRN: " & Me.TextBox4.Value & Chr(10) & _
                      "Post Code: " & Me.TextBox3.Value & Chr(10) & _
                      "Comments: " & Me.NotesBox.Value & Chr(10) & _
                      "Issue: " & Me.ComboBox3.Value & Chr(10) & _
                      "Action Required: " & Me.ComboBox4.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)
        aEmail.Recipients.Add (Worksheets("Email Links").Range("A2").Value)
    
        aEmail.CC = (Worksheets("Email Links").Range("B2").Value)
        aEmail.BCC = ""
        aEmail.Subject = "" & UserForm4.ComboBox3.Value & " " & Worksheets("Handover").Range("K1").Value
        aEmail.Display

End Sub
 
Upvote 0
You need to use the HTMLBody property and not the Body if you want to include HTML tags. Also, don't forget the closing </b> tag after the comments.
 
Upvote 0
Hi I have just changed it to the following but it still doesn't work, it comes up as all red. hope you can offer more advise?
HTML:
Private Sub CommandButton4_Click()
    If NotesBox.Value = "" Then
        MsgBox "Please enter 'Comments'"
        Exit Sub
    Else
    End If
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
        aEmail.HTMLBody = "Hi There," & Chr(10) & vbCrLf & _
                      "Appt Number: " & Me.TextBox5.Value & Chr(10) & _
                      "MPAN / MPRN: " & Me.TextBox4.Value & Chr(10) & _
                      "Post Code: " & Me.TextBox3.Value & Chr(10) & _
                      "<b>" "Comments: "</b> "" & Me.NotesBox.Value & Chr(10) & _
                      "Issue: " & Me.ComboBox3.Value & Chr(10) & _
                      "Action Required: " & Me.ComboBox4.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)
        aEmail.Recipients.Add (Worksheets("Email Links").Range("A2").Value)
    
        aEmail.CC = ""
        aEmail.BCC = ""
        aEmail.Subject = "" & UserForm4.ComboBox3.Value & " " & Worksheets("Handover").Range("K1").Value
        aEmail.Display
 
Last edited:
Upvote 0
You need something like this:

Rich (BB code):
        aEmail.HTMLBody = "Hi There," & Chr(10) & vbCrLf & _
                      "Appt Number: " & Me.TextBox5.Value & Chr(10) & _
                      "MPAN / MPRN: " & Me.TextBox4.Value & Chr(10) & _
                      "Post Code: " & Me.TextBox3.Value & Chr(10) & _
                      "<b>Comments: </b> " & Me.NotesBox.Value & Chr(10) & _
                      "Issue: " & Me.ComboBox3.Value & Chr(10) & _
                      "Action Required: " & Me.ComboBox4.Value & Chr(10) & vbCrLf & _
                      "Many thanks " & Chr(10)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top