Command Button: Add range of cells as body text?

LucyLucy

New Member
Joined
Sep 11, 2019
Messages
2
Hello, just getting stuck on a little thing here and wondered if anyone could help?

I have a command button to email a sheet, it's too much information for everyone on the mailing list so I'm hoping to just pop in a data range into the .body. I'm having problems :( is there a snippet to pop in here to grab some cells?

Much appreciated if anyone has 2 mins to look over it.

Private Sub CommandButton1_Click()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)


< THIS BIT BELOW>

xMailBody = "** This is an automated email from the Onsite Trade Schedule **" & vbNewLine & vbNewLine & _

"Please find the following information for your reference below." & vbNewLine

<pesky cell="" range="" needed="" here="" :(<CELL RANGE TO GO HERE>


On Error Resume Next

With xOutMail
.To = "#"
.CC = "#"
.BCC = "#"
.Subject = "Onsite Trade Schedule"
.Body = xMailBody
.Send

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


End Sub</pesky>
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
LucyLucy,
About the only thing I can think of would be to create a second worksheet into which you copy just the information you want to send and then send the second worksheet

hth,
Computerman
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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