• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sending mail through Outlook to different set of people and with different PDF attachment

Minakshi

New Member
Hi Wonderful team,

Pl help me with the VBA code. I want to send mails to 60 different people with same content in mail body and with same set of people in cc. However i need to send 60 different pdf files to each one.

Regards,
Minakshi
 
Hi

Since you are using Outlook, please try the following:

Code:
Sub Send_Email()

    Dim c As Range
    Dim OutLookApp As Object
    Dim OutLookMailItem As Object

    For Each c In Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).Cells
        Set OutLookApp = CreateObject("Outlook.application")
        Set OutLookMailItem = OutLookApp.CreateItem(0)
        With OutLookMailItem
                .To = c.Value
                .CC = "Your CC here"
                .Subject = "Your Subject here"
                .HTMLBody = "Your Body content here"
                .Attachments.Add c.Offset(, 1).Value
                .Display
    '            .Send
         End With
    Next c

End Sub

Sheet should look like (add as many destination emails / attachments as necessary):
1.JPG

With this sheet active, run the macro...
If you don't want the email preview window to pop up, simply comment block the ".Display" and uncomment block the ".Send"

Hope this helps
 
Last edited:
Hi

Since you are using Outlook, please try the following:

Code:
Sub Send_Email()

    Dim c As Range
    Dim OutLookApp As Object
    Dim OutLookMailItem As Object

    For Each c In Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).Cells
        Set OutLookApp = CreateObject("Outlook.application")
        Set OutLookMailItem = OutLookApp.CreateItem(0)
        With OutLookMailItem
                .To = c.Value
                .CC = "Your CC here"
                .Subject = "Your Subject here"
                .HTMLBody = "Your Body content here"
                .Attachments.Add c.Offset(, 1).Value
                .Display
    '            .Send
         End With
    Next c

End Sub

Sheet should look like (add as many destination emails / attachments as necessary):
View attachment 41206

With this sheet active, run the macro...
If you don't want the email preview window to pop up, simply comment block the ".Display" and uncomment block the ".Send"

Hope this helps
Thanks a ton PCosta
 
Back
Top