Sending Email with Excel with To, CC & BCC

mydragonstalents

New Member
Joined
Nov 19, 2013
Messages
3
Hi Everyone,

I am just learning about VBA but I got the basics down.

I am trying to use our excel to make it faster to send emails to out clients. We have a To, CC and BCC emails.

Each line would be its own client with emails:

To: CC: BCC:
B3: Client 1 C3: Client 1 D3: Client 1
B4: Client 2 C4: Client 2 D4: Client 2
B5: Client 3 C5: Client 3 D5: Client 3

Would I need a button for each row/client?

I don't want to send it automatically because I have to attach a statement manually, but also the subject would change each month.

Subject: Fund (Month) (Year)

Hope you guys can help.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi mydragonstalents,

With Outlook, here are the basics.

Code:
Sub eml()

    Dim objOutlook As Object
    Dim objMail As Object

    Set objOutlook = CreateObject("Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)

    With objMail
        .To = Range("B3").Value
        .cc = Range("C3").Value
        .bcc = Range("D3").Value
        .Subject = "Fund " & Format(Date, "MMM") & " " & Format(Date, "YYYY")
        .Body = Range("YOUR Range").Value
        '.Attachments.Add rngAttach.Value
        .Display                   'Instead of .Display, you can use .Send to send the email _
                                         or .Save to save a copy in the drafts folder
    End With

    Set objOutlook = Nothing
    Set objMail = Nothing
    'Set rngTo = Nothing
    'Set rngSubject = Nothing
    'Set rngBody = Nothing
    'Set rngAttach = Nothing

End Sub

HTH

igold
 
Upvote 0
I added a form control button and assigned it to the Macro but it's giving an error '400'.

Hi mydragonstalents,

With Outlook, here are the basics.

Code:
Sub eml()

    Dim objOutlook As Object
    Dim objMail As Object

    Set objOutlook = CreateObject("Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)

    With objMail
        .To = Range("B3").Value
        .cc = Range("C3").Value
        .bcc = Range("D3").Value
        .Subject = "Fund " & Format(Date, "MMM") & " " & Format(Date, "YYYY")
        .Body = Range("YOUR Range").Value
        '.Attachments.Add rngAttach.Value
        .Display                   'Instead of .Display, you can use .Send to send the email _
                                         or .Save to save a copy in the drafts folder
    End With

    Set objOutlook = Nothing
    Set objMail = Nothing
    'Set rngTo = Nothing
    'Set rngSubject = Nothing
    'Set rngBody = Nothing
    'Set rngAttach = Nothing

End Sub

HTH

igold
 
Upvote 0
I am sorry, I don't know why it is throwing that error. I tested it with a basic worksheet and it went fine. Perhaps another user will chime in. Additionally, you may want to do some independent research. I do not believe it is code related but rather something with the environment.

igold
 
Upvote 0
Actually after some tinkering it worked! I have everything set but how would I get the subject to say "Fund (Written Month) YYYY". I want the subject to have the previous month written out.

Private Sub CommandButton1_Click()
Dim objOutlook As Object
Dim objMail As Object

Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)

With objMail
.To = Range("B3").Value
.CC = Range("C3").Value
.BCC = Range("D3").Value
.Subject = "PMSBL Fund " & Format(Date, "MMM") & " " & Format(Date, "YYYY")
'.Attachments.Add rngAttach.Value
.Display

End With

Set objOutlook = Nothing
Set objMail = Nothing
'Set rngTo = Nothing
'Set rngSubject = Nothing
'Set rngBody = Nothing
'Set rngAttach = Nothing
End Sub

Thank you a tons BTW!
 
Upvote 0
Ah, before you thank me, let's see if this does it.

Please change this line:

Code:
.Subject = "PMSBL Fund " & Format(Date, "MMM") & " " & Format(Date, "YYYY")


To this:


Code:
 .Subject = "PMSBL Fund " & MonthName(Month(Date) - 1, False) & " " & Format(Date, "YYYY")



Hope this works for you!

igold
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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