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
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