lindalibinbin
New Member
- Joined
- Dec 23, 2013
- Messages
- 6
Hi Everyone,
Complete VBA newbie here. I have the following code for sending out an outlook email with an attachment, and there's one line in the body (cells(9,2) particularly) I would like to bold+underline. Please help! Much appreciated.
Sub Email()
'
'
Dim OutApp As Object
Dim OutMail As Object
Dim FileName1 As String
Dim Msg As String, URL As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
FileName1 = Cells(12, 2)
On Error Resume Next
With OutMail
.to = Cells(3, 2)
.CC = Cells(4, 2)
.BCC = ""
.Subject = Cells(5, 2)
.Body = Cells(6, 2) & vbCrLf & vbCrLf & Cells(7, 2) & vbCrLf & Cells(8, 2) & vbCrLf & vbCrLf & Cells(9, 2) & vbCrLf & vbCrLf & Cells(10, 2) & vbCrLf & Cells(11, 2)
.Attachments.Add (FileName1)
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Thanks again!
Complete VBA newbie here. I have the following code for sending out an outlook email with an attachment, and there's one line in the body (cells(9,2) particularly) I would like to bold+underline. Please help! Much appreciated.
Sub Email()
'
'
Dim OutApp As Object
Dim OutMail As Object
Dim FileName1 As String
Dim Msg As String, URL As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
FileName1 = Cells(12, 2)
On Error Resume Next
With OutMail
.to = Cells(3, 2)
.CC = Cells(4, 2)
.BCC = ""
.Subject = Cells(5, 2)
.Body = Cells(6, 2) & vbCrLf & vbCrLf & Cells(7, 2) & vbCrLf & Cells(8, 2) & vbCrLf & vbCrLf & Cells(9, 2) & vbCrLf & vbCrLf & Cells(10, 2) & vbCrLf & Cells(11, 2)
.Attachments.Add (FileName1)
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Thanks again!