sapxl
New Member
- Joined
- Jun 20, 2020
- Messages
- 24
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello Friends,
I'm trying to send the outlook email, where i want to send the bodytext of email would be the value of cells range which needs to be copy into my email body. I tried to do so, but unable to figure out.
Is there anyone who can help me out with this issue... appreciate your help in this regard. Thanks,
code:
I'm trying to send the outlook email, where i want to send the bodytext of email would be the value of cells range which needs to be copy into my email body. I tried to do so, but unable to figure out.
Is there anyone who can help me out with this issue... appreciate your help in this regard. Thanks,
code:
VBA Code:
Sub Outlookmail()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = Activate.Sheet1.Range("A1:H24").Value
''xMailBody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2"
On Error Resume Next
With xOutMail
.To = "abcxyz@gmail.com"
.CC = ""
.BCC = ""
.Subject = Cells(cell.Row, "B8").Value & Space(1) & "(" & Cells(cell.Row, "D8").Value & Space(1) & Cells(cell.Row, "F8").Value & ")" & Space(1) & "**DO NOT REPLY TO THIS E-MAIL**"
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub