Adjusting macro to send email

zioneye

New Member
Joined
Jul 13, 2008
Messages
5
For some reason this macro will send the workbook to Persons_Email_Addr
but not to Copy_To_Slay. What am I doing wrong?


Sub Email()
Dim Email_WB As Workbook
Dim Persons_Email_Addr As String
Dim Copy_To_Slay As String
Dim Email_Subj As String

On Error GoTo Email_Err
Set Email_WB = ActiveWorkbook
Persons_Email_Addr = "abc@abc.org"
Copy_To_Slay = "slay@abc.org"
Email_Subj = "New Travel Request"

Email_WB.SendMail Recipients:=Persons_Email_Addr, _
Subject:=Email_Subj

Email_Err:

End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Why would it send an email to Copy_To_Slay?

You don't specify that as a recipient anywhere in the code.:eek:
 
Upvote 0
You can either send the message twice, once to each address, or create an array with the addresses - something like this:

dim MailAdd(2) as string
...
MailAdd(1) = "abc@abc.org"
MailAdd(2) = "slay@abc.org"
...
Email_WB.SendMail Recipients:=MailAdd(), _
Subject:=Email_Subj
...

HTH
 
Upvote 0
I'm not super up on email macros but I don't see any option for CC in .SendMail

It looks like its also possible to have multiple recipients on the To line and use an array to enter this data:

Code:
Dim a As Variant
a = Array("abc@abc.com", "abc@abc.com")
wb.SendMail Recipients:=a

AB

Edit: Doh! Yes this is what Norie did too....used an array called MailAdd...
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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