Hi,
I am trying to send email (outlook) through excel VBA code. I am able to send mail with attachment using following code But I want to put range of cells in message body with format. I have a piviot in the excel which i want to copy in mail body.
Please help!
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Dim sbody As String
Dim prange As Range
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = "<email id>"
.CC = ""
.BCC = ""
.Subject = "Test mail"
.Body = "Hello World!"
.Attachments.Add ActiveWorkbook.FullName
' display the mail.
.display
' .Send
End With
'On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Bookmarks