VBA code to make text to BOLD and UNDERLINE

Prince27

New Member
Joined
Nov 24, 2012
Messages
41
Hi Experts,

I have the VBA code and i want to bold and underline the below text :

Required Information : -

Client/Information/Year :

Comments :

Please help me out in getting the syntax to make text as BOLD/UNDERLINE...in VBA...

Sub Mail()
'
'
'
'
'Macro Purpose: To send an email through Outlook
Dim objOL As Object
Dim objMail As Object
Dim sEmail As String
Dim sEmailColumn As String
Dim sSubject As String
Dim sBody As String
Dim lDataRow As Long
Dim cl As Range
'Set column with email address
sEmailColumn = "J"
For Each cl In Selection.Resize(, 1)
'Generate required info
lDataRow = cl.Row
'Check if Mail
If cl.Parent.Range("D" & lDataRow).Value = "Greetings" Then
With cl.Parent
sEmail = .Range(sEmailColumn & lDataRow)
sSubject = "JOB ID " & .Range("B" & lDataRow)
sBody = "Greetings " & .Range("A" & lDataRow) & "," & _
vbNewLine & vbNewLine & .Range("C" & lDataRow) & _
vbNewLine & vbNewLine & "Job ID" & " " & ":-" & " " & .Range("E" & lDataRow) & _
vbNewLine & vbNewLine & "Required Information" & " " & ":-" & _
vbNewLine & vbNewLine & "Client/Information/Year" & " " & ":" & " " & " " & .Range("F" & lDataRow) & " " & .Range("G" & lDataRow) & " " & "for the year" & " " & .Range("H" & lDataRow) & _
vbNewLine & vbNewLine & vbNewLine & vbNewLine & "Comments" & " " & ":" & " " & .Range("I" & lDataRow) & _
vbNewLine & vbNewLine & vbNewLine & "Thank You,"

End With
'Turn on error handling
On Error GoTo Cleanup
'Bind to Outlook
Set objOL = CreateObject("Outlook.Application")
'Create a new email and send it
Set objMail = objOL.CreateItem(0) '0=olmailitem
With objMail
.To = "ron@debruin.nl"
.BCC = "email2kmahe@gmail.com"
.Subject = sSubject
.Body = sBody
.Display
End With
End If
Next cl
Cleanup:
'Release all objects
Set objMail = Nothing
Set objOL = Nothing
On Error GoTo 0
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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