send_mail function question

ass98

New Member
Joined
Aug 30, 2002
Messages
31
i have a piece of code below which will email the current .xls file to everyone whos email address is in a range of cells specified

Sub Send_email()

Application.Dialogs(xlDialogSendMail).Show arg1:=Range("E3:E100").Value

End Sub

my problem is how can i email a particular sheet instead of the whole workbook?
This message was edited by ass98 on 2002-09-01 13:00
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Dragracer

Board Regular
Joined
Jun 9, 2002
Messages
151
Try this code.

<pre>
Sub mailsheet()
ActiveSheet.Copy
ActiveWorkbook.SendMail _
Recipients:="me@abc.com", _
Subject:="(" & ActiveSheet.Name & ") Test 1,2"
ActiveWorkbook.Close False
End Sub
</pre>

Hope it helps
 

ass98

New Member
Joined
Aug 30, 2002
Messages
31
can i get this code to email multiple recipients in selected cells?
 

Dragracer

Board Regular
Joined
Jun 9, 2002
Messages
151
yes you can. If you have a sort list you can hardcode them.<pre>
Recipients:=Array("me@abc.com", "you@xyz.com")</pre>

For a long list use a range.<pre>
Sub mailsheet()
Dim mailrange As Range

Set mailrange = ActiveSheet.Range("A1:A10")
ActiveSheet.Copy
ActiveWorkbook.SendMail _
Recipients:=mailrange.Value, _
Subject:="(" & ActiveSheet.Name & ") Test 1,2"

ActiveWorkbook.Close False
End Sub</pre>

Or you could loop through your range and send individual mail messages
This message was edited by Dragracer on 2002-09-01 16:15
 

Forum statistics

Threads
1,144,765
Messages
5,726,175
Members
422,660
Latest member
mrsteele

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
Top