Pasting cells from multiple sheets into an email help please

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi, i hope you can help again beginner at this and still learning :), i havethe code below which i have put in for command button, so when clicked it copiein the cells from a - k and only data that hasi want to do this multiple times heading above the code, but the below isnt helping any chanyou can help please?

Code:
Private Sub CommandButton7_Click()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim objdata As DataObject
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
Set objdata = New DataObject

.HTMLBody = "Replans," & "<br>" & .HTMLBody
ThisWorkbook.Sheets("Sheet2").Range("A:K").Copy
.HTMLBody = "ECOs," & "<br>" & .HTMLBody
ThisWorkbook.Sheets("Sheet3").Range("A:K").Copy
.HTMLBody = "Other Info," & "<br>" & .HTMLBody
ThisWorkbook.Sheets("Sheet4").Range("A:K").Copy


objdata.GetFromClipboard
varBody = objdata.GetText


With xOutMail
.To = "test@eonenergy.com"
.CC = "jeopardy.managers@eonenergy.com"
.BCC = ""
.Subject = "HANDOVER "
.body = varBody & vbCrLf & "Many thanks" & vbCrLf
.Display
.HTMLBody = "Hello There," & "<br>" & .HTMLBody

End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top