Sakthikumar Chinnasamy
Member
Hi All,
Need ur help to copy the pivot table data from pivot sheet of hosting-tending violate report xlsx file to body of the email. I have attached .png screenshot of output.
Note: If there is no data in the pivot table, i need to display in the message as "No violated tickets for incident"
I tried the below code but in the .body = I dnt know the code to copy and paste pivot table
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set mItem = outlookOBJ.CreateItem(olMailItem)
With mItem
.To = ThisWorkbook.Sheets("Email Template").Cells(3, 2).Value
.CC = ThisWorkbook.Sheets("Email Template").Cells(4, 2).Value
.Subject = Queue & " - Tending Violate Report _" & Format(Now(), "DD-MM-YYYY")
.Body =
ThisWorkbook.Save
.Attachments.Add ThisWorkbook.Path & "\" & Queue & " - Tending Violate Report_" & Format(Now(), "DD-MM-YYYY") & ".xlsx"
Need ur help to copy the pivot table data from pivot sheet of hosting-tending violate report xlsx file to body of the email. I have attached .png screenshot of output.
Note: If there is no data in the pivot table, i need to display in the message as "No violated tickets for incident"
I tried the below code but in the .body = I dnt know the code to copy and paste pivot table
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set mItem = outlookOBJ.CreateItem(olMailItem)
With mItem
.To = ThisWorkbook.Sheets("Email Template").Cells(3, 2).Value
.CC = ThisWorkbook.Sheets("Email Template").Cells(4, 2).Value
.Subject = Queue & " - Tending Violate Report _" & Format(Now(), "DD-MM-YYYY")
.Body =
ThisWorkbook.Save
.Attachments.Add ThisWorkbook.Path & "\" & Queue & " - Tending Violate Report_" & Format(Now(), "DD-MM-YYYY") & ".xlsx"