ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to send different ranges to multiple e-mail recipients (https://www.excelbanter.com/excel-programming/375222-how-send-different-ranges-multiple-e-mail-recipients.html)

Meghan

How to send different ranges to multiple e-mail recipients
 
I am trying to set up a macros that will allow me to send a specific range of
cells in a worksheet to multiple e-mail recipients. I don't have any problem
creating the first range of cells and e-mail address, but I am not sure how
to set up the next commands. Do you have any suggestions?

Sub MacroTest()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:H7", "A9:H12").Select

' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = False

' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With

End Sub


--
Thank you,
Meghan

Ron de Bruin

How to send different ranges to multiple e-mail recipients
 
Hi Meghan

The same range to more people ?
Maybe
http://www.rondebruin.nl/mail/tips2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Meghan" wrote in message ...
I am trying to set up a macros that will allow me to send a specific range of
cells in a worksheet to multiple e-mail recipients. I don't have any problem
creating the first range of cells and e-mail address, but I am not sure how
to set up the next commands. Do you have any suggestions?

Sub MacroTest()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:H7", "A9:H12").Select

' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = False

' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With

End Sub


--
Thank you,
Meghan




Meghan

How to send different ranges to multiple e-mail recipients
 
Hi Ron,

I'm trying to send different ranges to different people...each range has
information pertaining to a specific employee. Thanks!

"Ron de Bruin" wrote:

Hi Meghan

The same range to more people ?
Maybe
http://www.rondebruin.nl/mail/tips2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Meghan" wrote in message ...
I am trying to set up a macros that will allow me to send a specific range of
cells in a worksheet to multiple e-mail recipients. I don't have any problem
creating the first range of cells and e-mail address, but I am not sure how
to set up the next commands. Do you have any suggestions?

Sub MacroTest()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:H7", "A9:H12").Select

' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = False

' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With

End Sub


--
Thank you,
Meghan





Ron de Bruin

How to send different ranges to multiple e-mail recipients
 
Not much time now but you can create two arrays and loop through them

In this macro I do it with sheetname and e-mail addresses
Try to use it in your macro

Post back if you have problems
I check this posst later this evening
See also this page for another way to do it
http://www.rondebruin.nl/mail/folder3/mail4.htm


The example below will send each sheet in the Shname Array
to a person In the Addr Array.
In this example four separate mails will be send with one sheet.

Sheet1 to
Sheet2 to

Sheet3 to

Sheet4 to



Sub Mail_test()
Dim wb As Workbook
Dim strdate As String
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Shname = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
Addr = ", ", ", ")

Application.ScreenUpdating = False

For N = LBound(Shname) To UBound(Shname)
Sheets(Shname(N)).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & Shname(N) _
& " " & strdate & ".xls"
.SendMail Addr(N), _
"This is the Subject line"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Next N
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl



"Meghan" wrote in message ...
Hi Ron,

I'm trying to send different ranges to different people...each range has
information pertaining to a specific employee. Thanks!

"Ron de Bruin" wrote:

Hi Meghan

The same range to more people ?
Maybe
http://www.rondebruin.nl/mail/tips2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Meghan" wrote in message ...
I am trying to set up a macros that will allow me to send a specific range of
cells in a worksheet to multiple e-mail recipients. I don't have any problem
creating the first range of cells and e-mail address, but I am not sure how
to set up the next commands. Do you have any suggestions?

Sub MacroTest()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:H7", "A9:H12").Select

' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = False

' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With

End Sub


--
Thank you,
Meghan








All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com