VBA to Email diffrent email addresses and add dynamic excel file attachment


New Member
Hi All

Could someone please help me write a VBA to automatically email a list of emailaddresses in Column A and add an Excelfile attachment for that email address which is in Column D. Column C is the root directoryfor where all the files are kept.

I have a low understanding of VBA, but an idea. So any supportwould be welcome with any instructions you think I may need.

See picture below as an example, but I am happy to changelayout if required.

Thanks Russ
Last edited:


Well-known Member
You can use this small application to send several emails with different Subject and with different files.

https://www.dropbox.com/s/a0dpmr57n2hp70v/Email5c sample.xlsm?dl=0

Sub Enviar_Correos()
    '***Macro to send email
    col = Range("H1").Column
    For i = 2 To Range("B" & Rows.Count).End(xlUp).Row
        Set dam = CreateObject("Outlook.Application").CreateItem(0)
        dam.To = Range("B" & i).Value           'To
        dam.Cc = Range("C" & i).Value           'With copy
        dam.Bcc = Range("D" & i).Value          'hide copy
        dam.Subject = Range("E" & i).Value      'subject
        dam.Body = Range("F" & i).Value         'body
        For j = col To Cells(i, Columns.Count).End(xlToLeft).Column
            archivo = Cells(i, j).Value
            If archivo <> "" Then dam.Attachments.Add archivo
        dam.Send                                send
        'dam.Display                             'show
    MsgBox "End", vbInformation, "Regards"
End Sub

Some videos you may like

This Week's Hot Topics