VBA Excel

yaljubaili

New Member
Joined
May 23, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I send every month new updated information about the market to the clients by email, how can I put the clients list in BCC, put my manager CC, and attach PDFs about the market updated information, by using VBA Excel.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:
VBA Excel
VBA Excel - OzGrid Free Excel/VBA Help Forum
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Hi,
To send emails with specific recipients, CC, BCC, and attachments using VBA in Excel, you can use Microsoft Outlook. Here's an example of how you can do this:

VBA Code:
Sub SendEmail()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim RecipientList As Range
    Dim AttachmentPath As String
    Dim ManagerEmail As String
    
    ' Set the recipient list range containing client email addresses
    Set RecipientList = ThisWorkbook.Sheets("Sheet1").Range("A2:A10")
    
    ' Set the path of the PDF file(s) to be attached
    AttachmentPath = "C:\Path\to\PDF\File.pdf"
    
    ' Set the manager's email address for CC
    ManagerEmail = "manager@example.com"
    
    ' Create Outlook instance
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    
    ' Loop through each recipient and send email
    For Each Recipient In RecipientList
        With OutMail
            ' Set the email properties
            .To = Recipient.Value
            .CC = ManagerEmail
            .BCC = ""
            .Subject = "Monthly Market Update"
            .Body = "Dear Client, please find attached the latest market update."
            
            ' Attach the PDF file(s)
            .Attachments.Add AttachmentPath
            
            ' Send the email
            .Send
        End With
    Next Recipient
    
    ' Release the Outlook objects
    Set OutMail = Nothing
    Set OutApp = Nothing
    
    MsgBox "Emails have been sent successfully."
End Sub

Make sure to adjust the following parts according to your requirements.

Best Regards.
 
Upvote 0

Forum statistics

Threads
1,215,419
Messages
6,124,796
Members
449,189
Latest member
kristinh

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